Roger Federer continued to make heavy weather of a straightforward-looking draw at the French Open as he scraped past Nicolas Mahut 6-3 4-6 6-2 7-5 in the third round.

The world number three was not expected to be troubled until a scheduled quarter-final against either Tomas Berdych or Juan Martin Del Potro.

However, after losing a set to unheralded Romanian Adrian Ungur in round two, he again struggled and was forced to dig deep before serving out for a four-set victory.

Federer, who has reached 31 consecutive grand slam quarter-finals, breezed through the first set against Frenchman Mahut - most famous, of course, for his Wimbledon epic against John Isner two years ago.

The 30-year-old prefers faster surfaces but he was relishing the challenge of taking on a 16-time slam champion on his home stage and the second set was competitive from the start.

When Mahut brought up his first break point in the 10th game, it was also a set point, and he took it with a searing backhand return winner down the line. Federer looked a little flat and lacked some of his usual attacking spark but he responded in typical fashion by breaking in the third game of the third set and taking it easily.

The Swiss seemed to be on his way when, after saving a break point in the sixth game, he broke through at the very next opportunity. However, Mahut responded with some fine play to break straight back and sow the seeds of doubt once more. Not for long as it turned out, Federer taking his third chance to move 6-5 ahead and this time serving it out.

Federer is not unduly worried about his form and, with Mahut preferring the faster surfaces, felt the match was not a typical clay-court clash.

He said: "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. So that's tricky at times. I thought he did well. I struggled a little bit, but overall obviously I'm happy I came through."