ROME, Italy - The pendulum swung dramatically throughout one of the year's most anticipated showdowns - but it was the unseeded Maria Sharapova who emerged triumphant, downing No.5 seed Jelena Ostapenko 6-7(6), 6-4, 7-5 in three hours and 10 minutes to return to the Internazionali BNL d'Italia semifinals for the first time since 2015.

"It’s always nice to have a battle with a few ups and downs, and to finish strong," Sharapova told the media, following her victory. "To get through a match like this against a really high-quality opponent and to end up winning it, I’m quite proud of the effort."

Read more: Sharapova speaks in-depth after her win over Ostapenko

The first clash between the current and former Roland Garros champions was somewhat belated: the pair were due to face each other in the first round of Cincinnati last August until the Russian withdrew with an injury, and their putative second-round encounter in Madrid last week was stymied by Irina-Camelia Begu's upset of Ostapenko in the first round.

A titanic six-deuce, ten-minute opening game set the tone for an intensely contested battle that was well worth the wait. It showcased the full spectrum of Ostapenko's game: on the one hand, winners blitzed out of nowhere and rallies in which she upped the pace spectacularly with each shot; on the other, three double faults. But when the Latvian survived, she unleashed herself on the first set with full ferocity.

"I was playing like a rollercoaster, a little bit," Ostapenko said to the press, after the match. "I felt like I could win the match in two sets, because I had many opportunities and many breaks. I wasn’t serving that well today, it didn’t help me. I felt like if the serve was going better, it could help me more. But I was fighting, and that’s a good sign."

Few players have forced Sharapova to become a retriever, but as Ostapenko sped out to a 5-2 lead, her pace and accuracy was such that, at times, the 31-year-old was simply unable to keep up with her harder-hitting opponent in baseline rallies. Flailing after the reigning French Open champion's scorching shotmaking, she was forced to watch 18 magnificent winners fly past.

But Ostapenko also showed signs of carelessness in failing to take two opportunities for a double break lead, and as she reached the brink of the set her form began to oscillate wildly. Two set points came and went on return, both on netted forehands, and the 20-year-old promptly dropped her own serve to love.

Two more set points were spurned as Sharapova held serve to stay in the set once more, and when the Miami finalist offered up her fifth double fault to fall behind a break at 5-6, it seemed as though she had missed her chance.

However, the World No.40 was also having issues with her delivery - and responded in kind, sending down a sixth double fault to take the set into a tiebreak. There, Ostapenko was once more on the front foot: despite another two double faults, the Miami finalist played three of her best, most patient rallies of the day to save set point and take the lead.

The roller coaster continued into the second stanza. As had been the case in the first set, key points and momentum shifts were largely being determined by the quality of the serving: in total, both players would win over 66% of their first serve points, but under 40% of those behind their second deliveries. With the serves of each proving somewhat volatile, this meant that few leads would be safe.

Ostapenko broke first, smacking a forehand winner off a Sharapova defensive lob - but sent a forehand into the net to give up the advantage as the former World No.1, finding her range on the forehand, worked her way to a 4-2 lead. A spectacular backhand winner from off the back foot enabled the former junior Wimbledon champion to peg her opponent back to 4-4 - but, serving to stay in the set, a ninth double fault and a searing Sharapova return winner meant that the match would go all the way.

Despite the persistent sprinkling of double faults that took both into double figures - 10 for Sharapova and 11 for Ostapenko, five relatively straightforward holds opened the decider. But the five-time major champion had begun to clean up her ground game: whenever the pair got involved in a bludgeoning baseline rally, it was Sharapova who was able to maintain aggression without lapsing into wild error, while the tightrope Ostapenko perennially walks between those poles was starting to wobble.

With less to tee off on as Sharapova raised her first serve percentage to 73%, Ostapenko found getting on the front foot a much more formidable task - and one that caused her to lapse into impatience, netting a series of shots - out of a total of 61 unforced errors - to hand over the first break for 2-4. One Sharapova hold later, the Seoul champion was complaining of a pulled muscle and visibly limping.

Nonetheless, going gently into defeat is not Ostapenko's way. With her focus seemingly sharpened, the youngest player in the Top 10 began to hit her spots - while her older rival, on the verge of her second Top 10 win since her return to the sport, had a wobble of her own. A ninth double fault and a wide forehand saw her fail to close the match out on her own serve; two match points came and went thanks to impatient return errors, and a blazing Ostapenko backhand winner saw a 5-2 lead levelled up at 5-5.

The two final games, though, told a familiar tale of Sharapova's ability to put her struggles behind her. Continuing to go after her forehand in particular, she held firm on serve - and then, punishing the Ostapenko second serve with renewed vigor and accuracy, sealed a statement win with a backhand winner down the line.

"I felt like at the beginning of the match, I was playing more aggressive and stepping into the court, and Maria, she went a little bit back, so I took time away from her," explained Ostapenko. "Which I didn’t probably do in the third set as well -- I didn’t step in the court, and many, many rallies I couldn’t finish. I was too far from the court."

The three-time Rome champion's reward for one of the biggest victories of her return is a semifinal against either No.1 seed Simona Halep or No.7 seed Caroline Garcia as she seeks to make her first Premier final since 2015.