Roger Federer was made to work hard for a four-set victory over Nicolas Mahut in the third round of the French Open.
The 16-time Grand Slam champion coasted through the first set, but was broken in the final game of the second as the Frenchman levelled.
Normal service was resumed in the third set, but Federer was pushed all through the fourth before securing a 6-3 4-6 6-2 7-5 win and a tie with David Goffin.
World number one Novak Djokovic brushed Nicolas Devilder aside 6-1 6-2 6-2.
Federer's 235th career win at the Grand Slams looked likely to be routine when he broke Mahut in the fifth game of the match and closed out the first set.
But Mahut clung on in the second, and, when Federer went wide with a forehand in the final game to gift a break point, the world number 89 found the line with a backhand return to level the match.
World number three Federer, who has reached 31 consecutive Grand Slam quarter-finals, responded by breaking in the third game of the third set and taking it easily, and he seemed set to close out the win with a break in the seventh game of the fourth.
However, Mahut, most famous for his 2010 defeat by John Isner in the longest Grand Slam match of all time, broke back immediately to extend the set.
It would though, be only a temporary reprieve, as Federer took the third chance to break presented to him in the 11th game, and then served out for the match and a meeting with the unseeded Goffin.
"I struggled a little bit, but overall obviously I'm happy I came through," said Federer. "I knew he could play very well from the baseline, if he had time.
"It's a bit tricky when you want to play a clay-court match but actually it would be better to play a hard-court match. I thought he did well."
Belgian Goffin, 21, initially lost in the qualifiers but was handed a place in the main draw after the withdrawal of Gael Monfils.
With his straight-sets win over Lukasz Kubot, he became the first "lucky loser" to reach the last 16 of a Grand Slam since fellow Belgian Dick Norman at Wimbledon in 1995.
Djokovic, bidding to become the first man since Rod Laver in 1969 to hold all four Grand Slams simultaneously, was at his clinical best to race past Frenchman Devilder and ensure he will have Saturday off.
Last on court Suzanne Lenglen, the Serbian sprinted through in only one hour and 44 minutes to beat the fading Paris light.
Devilder contributed to an entertaining encounter, but Djokovic's precise and powerful groundstrokes ensured he had few problems as he aims to better his semi-final appearance of 2011, the last time he was beaten in a Grand Slam match.
Djokovic said: "The last 15 minutes was very hard. But it was very important for me to finish the match on the day. I wouldn't like to come back the next day and play a few games."
He will next meet Italian Andreas Seppi after the Italian, seeded 22, beat Spanish 14th seed Fernando Verdasco in five sets, 7-5 3-6 6-3 4-6 6-2.