It was also the Swiss star’s record-equalling 58th win at Roland Garros, but he did it the hard way, briefly staring at his earliest exit at a major since losing to Gustavo Kuerten in Paris in the third round in 2004.
Federer goes on to face French sixth seed Jo-Wilfried Tsonga for a place in the semi-finals after taking his career five-set record to 22-1.
“It was a great atmosphere in which to play like this. It became difficult in the second set as Gilles turned it around,” said Federer.
“I am proud of the record (of 36 quarter-finals in succession). It’s a lot of years, a lot of sacrifices and a lot of matches like this.”
There was no hint of the drama to come when the 2009 champion, playing in a 56th consecutive Grand Slam, carved out breaks in the third and fifth games to take the first set against a player he had beaten for the loss of just three games in Rome last month.
But once the great Swiss had suffered an awkward fall in the seventh game of the second his momemtum also took a dive with 28-year-old Simon breaking immediately on his way to levelling the match.
The Frenchman was in the ascendancy and rode a double-break in the third for a two sets to one lead.
However, refreshed by a break off the court to gather his thoughts and reconstruct his game, 17-time Grand Slam champion Federer levelled the tie courtesy of breaks in the sixth and eighth games of the fourth set.
The spirit seeped away from Simon, who had already played two five-setters in his three previous rounds.
Federer reeled off seven straight games from 2-2 in the fourth set to take control of the decider at 3-0 and took the match on a second match point when Simon slapped a backhand wide.