This was their first-ever meeting and Osaka had the best possible start no one would have expected.
The win offers the former world No.4 Stosur the chance to re-enter the top 40, where she has only spent one week since August.
Osaka surged to a 2-0 lead in the first set as Sharapova struggled to find consistency with her serve and made too many unforced errors to give her opponent any trouble. Nonetheless, Sharapova was able to regain her composure, recovering from the huge deficit to return level after playing an impressive return game to grab back the break with a return victor.
She suffered early breaks in both sets, fought back but came up short on the key points in a performance that saw her commit six double faults and lose five service games to world No. 44 Osaka.
She trailed 4-1 in the first set before holding serve at 4-all. "There's basically three people I wanted to play: It was Venus, her, and Serena", she said. "I ticked two people off so now I just have to play Serena and I'm really looking forward to that".
Although a fantastic backhand down-the-line victor earned her a game point, the Russian crumbled mentally as she threw in a double-fault on deuce, gifting Osaka a chance to close out the match.
Osaka will now play World No.31 Agnieszka Radwanska in the next round.
Meanwhile, Yuki Bhambri outsmarted Ramkumar Ramanathan in the battle of top Indians to qualify for the Indian Wells ATP Masters event, his first 1000 series tournament in nine years.