(adds Nadal result in ninth para)
Oct 10 (Reuters) - Fifth seed Roger Federer was dumped out of the Shanghai Open, losing to Frenchman Gael Monfils 6-4 6-7(5) 6-3 in the third round on Thursday, while top seed Novak Djokovic progressed.
After dropping the first set, the 17-time grand slam title winner Federer was on the brink of going out in straight sets at 3-5 down in the second, and later 3-5 down in the tie-break before winning four straight points.
Monfils then broke the Swiss former world number one in the fourth game of the decider.
It was Monfils's second victory over Federer in eight meetings, and leaves the Swiss battling to reach the end-of-season ATP World Tour Finals for the 12th consecutive year.
"I knew that I choked on this forehand at 5-4 (in the tie-break)," Monfils told the tour website (www.atpworldtour.com).
"Then I changed my ideas because I was maybe nervous, too. Even (though) I was tired, I tried to play more aggressively sometimes, going more for my shots and it worked.
"It's a good win for me. I feel a bit sorry for him because I know he's running for London. But it's tennis. He's going to have more opportunity (in) those weeks coming up."
Monfils will play top seed and defending champion Djokovic in the quarter-finals after the Serb defeated Fabio Fognini of Italy 6-3 6-3.
World number one Rafa Nadal of Spain overcame Argentine Carlos Berlocq 6-1 7-6(5), while sixth seed Juan Martin del Potro, Frenchman Jo-Wilfried Tsonga, German Florian Mayer and Nicolas Almagro of Spain also advanced.
Del Potro went through after German Tommy Haas withdrew due to injury, while Tsonga beat Japan's Kei Nishikori 7-6(5) 6-0.
Mayer beat 2011 runner-up David Ferrer 6-4 6-3 and Almagro beat Czech fourth seed Tomas Berdych in three sets. (Reporting by Josh Reich; editing by Toby Davis)