The world number two has had to work hard in the event, saving two match points in a three-hour battle with Czech Lucie Safarova in her first match this season on clay on Thursday. She did not need quite as long against Ivanovic but still took over two and quarter hours to secure the victory.
There was some controversy in the match though as Sharapova took a lengthy toilet break after the second set just when it looked like the momentum had shifted to the unseeded Serbia.
"I prefer playing tough matches instead of training at home," the Russian told reporters. "It was hard to get my body going - I need some time to warm up."
World number five Li Na withstood a late comeback from Petra Kvitova to beat the fifth-seeded Czech 6-3 7-5 and set-up a semi-final with American qualifier Bethanie Mattek-Sands.
The second seed from China was put under early pressure by a series of sizzling Kvitova groundstrokes but responded by rattling off five consecutive games to snatch the first set.
World number eight Kvitova took an early 2-0 lead in the second set before Li bounced back again, reeling off another five straight games.
The Australian Open runner-up then twice had her serve broken as the mercurial Kvitova blasted a string of superb service returns past her opponent to level at 5-5.
A fine volley and a brilliant return from an unimaginable angle put Li 6-5 ahead and she finally went through on her third match point when the Czech netted a backhand.
Mattek-Sands advanced with a 6-4 6-2 win over German Sabine Lisicki.
WTA Stuttgart results
2-Li Na (China) beat 5-Petra Kvitova (Czech Republic) 6-3 7-5
1-Maria Sharapova (Russia) beat Ana Ivanovic (Serbia) 7-5 4-6 6-4
Bethanie Mattek-Sands (U.S.) beat Sabine Lisicki (Germany) 6-4 6-2
3-Angelique Kerber (Germany) beat Yaroslava Shvedova (Kazakhstan) 6-3 7-6(2)
WTA Marrakech results
6-Francesca Schiavone (Italy) beat 3-Alize Cornet (France) 6-4 6-4
Chanelle Scheepers (South Africa) beat 7-Kristina Mladenovic (France) 6-1 6-2
Lourdes Dominguez Lino (Spain) beat 5-Kiki Bertens (Netherlands) 6-4 4-6 6-3
Mandy Minella (Luxembourg) beat Silvia Soler Espinosa (Spain) 6-3 3-6 6-3
- Sports & Recreation
- Petra Kvitova
- Angelique Kerber
- Ana Ivanovic
- Yaroslava Shvedova