Seventh seed Sharapova looked to be on course for defeat after dropping the opening set to Australian Stosur, but recovered to claim a 3-6 6-4 6-0 victory.
The 2012 champion had not lost a set in this year's tournament ahead of her fourth-round clash, but that quickly changed as 2010 finalist and 2011 US Open winner Stosur took charge.
Sharapova was quick to respond, breaking immediately in the first game of the second set.
Yet Stosur continued to show great determination and got things back on serve at 2-2 just three games later.
The match soon turned in Sharapova's favour, though, as she broke Stosur's serve to love to take a 5-4 lead before holding firm to force a final set.
Sharapova's game had been littered with unforced errors in the opening two sets, but the 27-year-old cut a different figure in the decider as she dominated Stosur in every aspect.
The four-time grand slam champion will take on Garbine Muguruza, conqueror of Serena Williams, in the last eight after the Spaniard beat Pauline Parmentier 6-4 6-2.