Averting a mounting crisis in the middle of a spectacular match, Federer won the last two sets to reach his 36th consecutive grand slam quarter-final and keep alive his hopes of a second title at Roland Garros.
When 15th seed Simon, roared on by chants of "Gillou", won the third set, Federer looked to be in danger but the 17-times grand slam champion hit back with every weapon in his arsenal to set up a quarter-final with another French hope, Jo-Wilfried Tsonga.
It was nerve-wracking until the end, however, with Federer missing an easy volley when serving for the match at 5-3 to offer Simon hope of a late escape.
Federer then wasted his first match point with an anxious forehand swiped into the net but when a second opportunity came his way Simon pushed a backhand into the tramlines.
"It was beautiful, it's always special to play matches like that," 2009 champion and firm Paris favourite Federer said at courtside. "You always remember matches like this."
The victory was 31-year-old Federer's 58th at the French Open, making him joint leader with Guillermo Vilas and Nicola Pietrangeli on the all-time list of matches won here.
The Swiss had to dig into his vast repertoire of strokes to subdue Simon - a player who has troubled him before and who won the first two of their five previous meetings.
There were the delicate drop shots, lob volleys, the backhand slices that seem to hang in the air for eternity and then those explosive forehands that few players can return.
Federer even managed to curl one winner between the outside of the net post and the umpire's chair to give him a sixth and final set point in the opener.
Everything looked under control for Federer until he stumbled and fell in the sixth game of the second set.
There was no obvious damage but he was broken in the next game and Simon rammed home the advantage to level the match.
A flustered Federer dropped his serve twice in the third set as Simon, bidding to reach the quarter-finals at his home grand slam for the first time, sensed his chance for a huge upset.
Federer has made a career out of pulling out the stops when required, however, and quickly restored order, overpowering a tiring Simon in the fourth set with some belligerent tennis.
An early break in the fifth gave Federer breathing space and despite a few nervous moments at the end he claimed the 900th Tour victory of his career.
Tsonga easily dispatched Serbian Viktor Troicki 6-3 6-3 6-3 to book his place in the quarter-finals.
Tsonga, the last Frenchman to reach a Grand Slam final at the 2008 Australian Open, has yet to drop a set at Roland Garros this year and sealed a straightforward win in one hour 45 minutes.
He will next take on Swiss great Federer, who struggled past France's 15th seed Gilles Simon in five sets.
Tsonga beat Federer in the Wimbledon last-eight in 2011 and is desperate to repeat that kind of achievement on a more regular basis.
"I know fully well that I was able to beat them (the top players) at a given point in time, and for me the real challenge is not to beat one but to beat several, one after the other," he told a news conference.
"Beating one - I know that I'm able to do that. Beating two, well, for the time being, I have never done it. So that's the challenge."
Despite the Wimbledon loss, Federer has a 9-3 record against the Frenchman overall and Tsonga's over-reliance on his forehand could again be exposed.
The Frenchman is well aware of that fact.
"I have been working on my backhand since I was the age of five. And it's a disaster, my backhand, so I'm working on it," he said.
Tsonga, still on course to become the first Frenchman to win a grand slam title since Yannick Noah at Roland Garros in 1983, has matched last year's performance in Paris where he was knocked out in the quarters by Novak Djokovic after wasting four match points.
"It's great to win again in three sets but in the following round it is going to be dreadful," Tsonga earlier told a courtside interviewer.
Richard Gasquet, the seventh seed, is another Frenchman left in the draw. He plays Swiss ninth seed Stanislas Wawrinka on Monday.
On a windswept Court Philippe Chatrier, after dark clouds had eaten away the last bit of morning sun, Tsonga whizzed through the first set.
World number 57 Troicki upped the tempo in the second set but cracked in the seventh game when Tsonga caught him off guard with a flicked lob which the Serbian returned into the net.
Tsonga broke decisively in the sixth game of the third set with one of his 17 forehand winners and wrapped it up on his third match point before doing his trademark victory swirl on court.
2-Roger Federer (Switzerland) beat 15-Gilles Simon (France) 6-1 4-6 2-6 6-2 6-3
4-David Ferrer (Spain) beat 23-Kevin Anderson (South Africa) 6-3 6-1 6-1
6-Jo-Wilfried Tsonga (France) beat Viktor Troicki (Serbia) 6-3 6-3 6-3
32-Tommy Robredo (Spain) beat 11-Nicolas Almagro (Spain) 6-7(5) 3-6 6-4 6-4 6-4