The Russian missed two match points at 5-3, allowing Ostapenko to draw level after 10 games, but Sharapova was not to be denied as she booked a semi-final spot in Rome for the first time in three years.

“It’s great to back at this stage,” Sharapova said.

“My fans have been so loyal throughout the years and for me to be able to produce this kind of tennis again in front of them is very special.”

Estonia’s Anett Kontaveit knocked out world number two Caroline Wozniacki 6-3 6-1 to record her second consecutive win over a top-10 opponent.