Federer entered the tournament needing to reach the quarterfinals to make sure Novak Djokovic didn't supplant him as the world's No. 1-ranked player. But he had a rally for a 4-6, 7-6 (7-4), 6-0 win over Swiss countryman Stanislas Wawrinka to make the quarters.
Wawrinka, who has beaten Federer once in their 13 meetings, used a break in the middle of the first set to grab the advantage and one late in the second to force the tiebreaker. Federer then won four of the last five points in the tiebreaker and dropped just five points in the third set to survive.
Djokovic won in much more convincing fashion, stopping Feliciano Lopez 6-3, 6-3 in 68 minutes. Djokovic lost only seven points in nine games serving.
World No. 3 Andy Murray, a two-time defending champion in Shanghai, rolled over Alexandr Dolgopolov 6-2, 6-2 in less than an hour. He did drop serve once but still took 75 percent of the points on serve.
Fourth-seeded Tomas Berdych, who beat Sam Querrey 6-2, 6-7 (3-7), 6-4; No. 5-seeded Jo-Wilfried Tsonga, who defeated Marcos Baghdatis 6-2, 7-6 (7-2), and 10th-seeded Marin Cilic, who stopped Fernando Verdasco 4-6, 6-1, 6-4 also earned spots in Friday's quarterfinals.
Swim Week Miami Beach 2014 [PHOTOS]