World number one Serena Williams saved three match points to reach the quarter-finals of the Madrid Open.
The American was on the brink of defeat when Victoria Azarenka went 6-5 and 40-0 up on serve in the deciding set.
But Williams fought back with two winners before the 25-year-old Belarusian served three straight double faults to surrender the game.
Williams, 33, then ran away with the tie-break to complete a 7-6 (7-5), 3-6, 7-6 (7-1) victory.
"It was intense," said Williams after her win, which took two hours 43 minutes. "I could have won, she could have won.