South African 15th seed Kevin Anderson has upset British third seed Andy Murray 7-6 (7/5), 6-3, 6-7 (2/7), 7-6 (7/0) at the US Open to reach his first major quarter-final.
Jon Isner put up a good fight against second seed Roger Feder but the Swiss veteran advanced to the quarter-finals with a 7-6 (7/0), 7-6 (8/6), 7-5 victory.
Federer will play French 12th seed Richard Gasquet who eliminated Czech sixth seed Tomas Berdych 2-6, 6-3, 6-4, 6-1.
Murray, the 2012 champion, saw his run of 18 consecutive major quarter-finals come to an end.
The 28-year-old Scotsman last failed to reach a slam last eight at the 2010 US Open.
"It was the match of my life," said Anderson.
"Andy is such a great fighter and amazing player.
"I just tried to stick with it after that third set tiebreaker. I wish I could play a fourth set tiebreaker like that all the time.
"This is a great accomplishment for me."
Federer, trying to become at 34 the oldest US Open champion since Ken Rosewall in 1970, stretched his US Open win streak over Americans to 12 since losing to Andre Agassi in 2001.
Isner had held in 110 consecutive US Open service games since broken by Germany's Philipp Kohlschreiber in the third round in 2013, but Federer ended that streak on match point to close out the victory in two hours and 39 minutes.
"John has one of the best serves in the game," Federer said. "You have just got to hang around and win your service games."