The second seed, still needing a French Open to become only the sixth man to complete a career Grand Slam, will now face either American sixth seed Andy Roddick or Gael Monfils, the 11th-seeded Frenchman, for a place in the semi-finals.
It was Federer´s fifth career recovery from a two-set deficit and he did it for the second Grand Slam in succession, after the Czech Republic´s Tomas Berdych had been 2-0 ahead in their Australian Open fourth-round tie.
But having seen four-time champion Nadal, the man who has beaten him in the last three finals, sensationally suffer his first defeat in Paris on Sunday, Federer came dangerously close to seeing his lifetime dream also evaporate.
At two sets to the good, 31-year-old Haas had a break point in the eighth game of the third set which, had he seized it, would have given him the chance to serve for the match.
But Federer, who hasn´t failed to reach a Grand Slam quarter-final since his third-round loss to Gustavo Kuerten here in 2004, saved it with a forehand pass and the German began to wilt with the Swiss reeling off 14 of the last 16 games.
Despite having lost eight of their 10 meetings, Haas went into the Court Philippe Chatrier clash knowing he could push Federer in a Grand Slam showdown, having twice taken him to five sets, at the 2002 and 2006 Australian Open.
Serve dominated the opening set before Haas, the oldest man left in the tournament, took the tiebreak.
The Swiss broke to lead 2-1 in the second set, as normal service appeared to be resumed but the German, whose career has been blighted by constant battles with shoulder trouble, levelled at 4-4 after an error-strewn Federer service game.
Federer saved a set point in the 12th game, but a loose forehand gave former world number two Haas another opportunity which he gleefully seized when the second seed dumped a lazy forehand into the net.
Federer then crucially saved a break point with an inside-out forehand to hang on at 4-4 in the third set, broke back to lead 5-4 and then confidently served out for the set.
The former world number one was a man transformed and he raced through the fourth set with three breaks to level the tie. Having committed 26 unforced errors in the first three sets, he was spotless in the fourth.
Haas was feeling the strain and a wild, tired forehand gave Federer a break to lead 3-2 in the decider which soon became 4-2 on the back of three aces from the Swiss.
Another break gave him a 5-2 advantage.
Haas saved one match point but was powerless on the second when he fired a forehand wide of the mark.
Merciless Serena books last-eight Kuznetsova clash
American second seed Serena Williams set up a French Open quarter-final meeting with Russia´s seventh seed Svetlana Kuznetsova after blazing through her fourth-round match here on Monday.
Williams, the 2002 champion, took just 53 minutes to see off Canadian 24th seed Aleksandra Wozniak 6-1, 6-2, while Kuznetsova triumphed 6-4, 1-6, 6-1 against Polish number 12 seed Agnieszka Radwanska.
"It was my most focused match so far and I was able to stay focused throughout," said Williams, who had looked short of sharpness in her opening three matches, twice being taken to three sets.
"It´s all mental. I woke up today feeling great and I knew I was going to have a great day.
"This is when everything counts. I have to pick up my level and play again, especially against Svetlana, who moves really well and doesn´t do anything bad."
‘They have to do their job’ - Federer has say on Serena US Open...
Wozniak was playing in the fourth round at a Grand Slam for the first time and Williams encountered little resistance in the first set, breaking twice before wrapping up the set with a full-bodied smash.
Williams, bidding for her 11th Grand Slam singles title and third in a row, was able to move her opponent around the court at will and took full advantage of the Canadian´s feathery serve to cruise into the French Open quarter-finals for the sixth time.
Kuznetsova, the 2006 French Open runner-up, overcame a mid-match stumble to beat 20-year-old Radwanska 6-4, 1-6, 6-1 on Court Suzanne Lenglen.
"I was nervous today, I don´t know why," said Kuznetsova.
"I think she was too. The first set was not great for both of us but I served well. The second set I played really bad and did a lot of mistakes. I wasn´t moving much.
"After I went to change my clothes (at the end of the second set) and then I started thinking a bit, I improved my game.
"Something positive about this match is that it happened today and I didn´t lose. I´m not happy to play three sets but I´ve been through a bit of a fight. The other matches were too easy so I needed a test."
The 23-year-old Russian, French Open runner-up in 2006, looked in command of the tie as she won the first set before Radwanska upped her game in the second, attacking Kuznetsova´s serve and forcing the Russian into errors.
The Pole broke twice to romp ahead, levelling the match with an ace at 5-1 up and taking the tie into a decider.
Kuznetsova had lost her previous two matches against Radwanska, who has never progressed beyond the fourth round at Roland Garros, but she rediscovered her rhythm in the third set.
After breaking at the first opportunity, an inch-perfect backhand into the bottom-right corner of the court gave Kuznetsova a second break and a 4-0 lead and she served out for the match to set up a meeting with Williams.