Britain's Andy Murray , the sixth seed, beat Switzerland's Stanislas Wawrinka 6-1 6-3 6-3, and will next play Argentina's Juan Martin del Potro , who defeated Kei Nishikori of Japan 6-3 6-4 6-3.
But a surprise four-set defeat by Switzerland's Stanislas Wawrinka followed in the third round at Flushing Meadows, with the Briton beset by physical issues that he was unable to explain immediately afterwards.
Djokovic is on course to meet defending champion Rafael Nadal in the final after the Spaniard maintained his incredible winning streak in Monte Carlo with a 7-5 6-4 victory over Poland's Stanislas Wawrinka.
If Federer's inclusion for China was a foregone conclusion, Wawrinka's presence was anything but guaranteed.
CNN: Why Federer's friend is flying the Swiss flag at London 2012
The tournament, which is not an official ATP Tour event, also featured Russia's Nikolay Davydenko and Federer's Swiss compatriot Stanislas Wawrinka.
The other quarterfinal will be between 21-year-old Canadian Milos Raonic, who beat fifth-seeded Czech Tomas Berdych, and Federer's Swiss compatriot Stanislas Wawrinka -- who defeated Japanese No. 14 Kei Nishikori.
Defending champion Federer meets Australia's Peter Luczak in the first round, but could face his fellow Swiss Stanislas Wawrinka, last-year's runner-up Robin Soderling, Latvia's in-form Ernests Gulbis and Murray en route to the final.
"Playing against Wawrinka, it's impossible have an easy match, " said Nadal after his win.
Lukas Rosol had helped the defending champions take a 2-1 lead against Switzerland after a record-breaking seven-hour doubles clash, but his playing partner Tomas Berdych put the tie beyond the home team as he won Sunday's opening doubles rubber against Stanislas Wawrinka.
Wawrinka came into Sunday's match as a heavy underdog against the fourth seed, who was tipped by most to challenge for a first Grand Slam title over the next week.
Top seed Novak Djokovic is also through to the third round following a 6-2 6-3 win over Florent Serra of France and the Serb will now face 13th-seeded Swiss Stanislas Wawrinka -- last weekend's Casablanca champion.
Murray's surprise third-round defeat by Stanislas Wawrinka at Flushing Meadows last month had been followed by a listless display against Ivan Ljubicic in Beijing just nine days ago, but a kind draw in Shanghai helped the Scot work his way back into some form during the early rounds and secure a place at the end-of-season ATP World Tour Finals in London.
BBC: Andy Murray beats Roger Federer to win Shanghai Masters
There were also victories on Tuesday for France's No. 7 seed Richard Gasquet, Stanislas Wawrinka, seeded 13 and Juan Monaco.
Nadal will now face France's Jo-Wilfried Tsonga, who saw off Stanislas Wawrinka 2-6 6-3 6-4 in his quarterfinal tie.
Roddick, who has described the tour schedule as "ridiculous" and has yet to qualify for next month's World Tour finals in London, withdrew from his match against Stanislas Wawrinka with a knee injury on Tuesday.
Murray is seeking to restore his composure after being beaten in less than an hour by Stanislas Wawrinka, a result that will see the Swiss 13th seed's absent compatriot Roger Federer return to No. 2 in the rankings.
CNN: Nadal 'relaxed' as rivals struggle at Monte Carlo Masters
Spanish 10th seed Nicolas Almagro came from 2-1 down to beat Bulgaria's Grigor Dimitrov in five sets to book a tie with Swiss 21st seed Stanislas Wawrinka , who beat 2006 finalist Marcos Baghdatis of Cyprus, 7-6 6-4 5-7 6-1.
But there was bad news for Djokovic's conqueror, Dimitrov, who was beaten 3-6 6-4 6-1 by Stanislas Wawrinka.
应用推荐