Rafael Nadal saved five match points before coming through 3-6 7-6 (7-2) 7-5 against fellow Spaniard Nicolas Almagro in the second round of the Paris Masters.
Nadal, the second seed, had won all four of his previous meetings with Almagro in straight sets but was immediately on the back foot in the French capital.
The unseeded Almagro dominated the first set but the second was a lot tighter, Almagro saving a set point at 5-4 down before breaking Nadal in the next game to serve for the match.
Nadal, however, survived five match points with some brilliant winners to capture his opponent's serve and force a tie-break, which he won 7-2 before needing treatment for a blister on his right foot.
The pair traded breaks in the decisive set, Almagro again failing to serve out the match at 5-3 up before Nadal claimed the telling break in the 11th game.
Pain and exhaustion meant Almagro - who had received treatment on a sore left thigh during the match - could hardly move when Nadal converted his first match point to bring an end to three hours and 14 minutes of drama.
Nadal advances to play another Spaniard, Tommy Robredo, who moved past former champion Tomas Berdych of the Czech Republic 6-4 6-4.
Earlier, world number three Novak Djokovic also advanced to the third round with a routine 6-3 7-5 win over Juan Monaco.
The Serb, who defeated Roger Federer in the Swiss Indoors final on Sunday to win his fourth title of the year, dominated in the opening set but was made to work hard when his unseeded Argentine opponent fought back in the second.
The third seed salvaged a set point with a volley to come back from 5-2 down in that second set and recovered to complete the victory when Monaco netted a forehand on the first match point after an hour and 32 minutes.
"I didn't feel that great on the court," said Djokovic.
"It was probably a long week in Basel that affected that. But I got a victory and that's what matters most.
"Generally speaking I've picked up great form in the last two months."
The next test for Djokovic will be a clash against Frenchman Arnaud Clement after he dispatched Germany's Tommy Haas in three sets.
Meanwhile, ninth seed Robin Soderling of Sweden kept alive his slender hopes of making the ATP World Tour Finals in London with a 6-4 7-6 win over Croatia's Ivo Karlovic.