Serbia's Novak Djokovic claps his hands after winning his singles tennis match against Spain's Feliciano Lopez at the Shanghai Masters tournament October 11, 2012 (Photo: Reuters)
The top-ranked Federer beat Davis Cup teammate Stanislas Wawrinka 4-6, 7-6 (4), 6-0 on Thursday in the third round.
Federer struggled to string points together early, with his backhand looking shaky through much of the first two sets, but he recovered late and advanced to the quarterfinals.
Novak Djokovic and Andy Murray also reached the quarters. Djokovic defeated Feliciano Lopez of Spain 6-3, 6-3 and Murray beat Alexandr Dolgopolov of Ukraine 6-2, 6-2.
The second-seeded Djokovic had 12 aces and won 27 of 29 first-serve points. The third game of the second set was the only time in the match that the Serb lost two points on serve.
''I'm trying to enjoy the efficiency of my serve,'' said Djokovic, who had three aces in one game in the first set. ''I'm not very well known around the tour for big serving. But so far in this tournament, and also in Beijing, it has been working very well for me. It has been giving me a lot of free points, a lot of confidence into the matches.''
Fourth-seeded Tomas Berdych of the Czech Republic defeated Sam Querrey of the United States 6-2, 6-7 (3), 6-4, and fifth-seeded Jo-Wilfried Tsonga beat Marcos Baghdatis of Cyprus 6-2, 7-6 (2).
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO Sports and on Facebook at AhramOnlineSports)