Maria Sharapova booked her place in the last four of the Madrid Open after edging a tight quarter-final against second seed Li Na 2-6 7-6 (7-5) 6-3.
The Russian eighth seed had to show all her battling qualities on the clay at the futuristic Caja Magica to dispatch her opponent and set up a semi-final with third seed Agnieszka Radwanska.
Sharapova looked to be heading out as she trailed by a set and a break at 3-4 down in the second.
However, she broke back immediately and, despite needing four set points, finally forced the match into a deciding set when Li netted at 5-6 down in the tie-break.
There were three breaks of serve to open the third set, but Sharapova took control when she finally consolidated the break at 3-1 and was gifted the final game when Li double faulted on match point.
"I will say the match was very close. I think it really could have gone her way today," admitted Sharapova.
"It was just a matter of a few points in the second set and in the third, although I was up a break throughout the third set, you know she's not going to let go. I didn't win the match until the last point was played."
The four-time Grand Slam champion was beaten by Serena Williams in Madrid in the last two years, including in the 2013 final.
But her chances of going one better this year were boosted by the news that Williams was forced to withdraw before her quarter-final against Czech fifth seed Petra Kvitova due to a thigh injury.
Radwanska also had to work hard to make it through, the Pole eventually getting the better of France's Caroline Garcia 6-4 4-6 6-4.
And in Friday's other quarter-final, fourth seed Simona Halep romped past 11th-seeded Serb Ana Ivanovic 6-2 6-2.
The Romanian will now play Kvitova for a place in Sunday's final.