The Swiss no 3 seed, seeking his record sixth title in New York, will now face 33rd seed Philipp Kohlschreiber, who defeated John Millman 7-5, 6-2, 6-4. Federer will be keen to extend his title winning run this season after the 36-year-old captured the Australian Open and Wimbledon crowns.
In other matches, no 10 seed US 10th seed John Isner was ousted by 23rd seed Mischa Zverev in straight sets while No 9 seed David Goffin advanced to the next round after his opponent Gael Monfils retired in the second set.
Aleksandr Dolgopolov beat Viktor Troicki in straight sets while Andrey Rublev was stretched to four sets by Damir Dzumhur.
Pliskova survives Zhang
On the women’s side, top seed Karolina Pliskova survived a scare against Zhang Shuai in her third round match. The world no 1 saved a match point in the second set to eventually triumph 3-6, 7-5, 6-4.
“I was match point down and I thought I haven't tried many forehand winners down the line. That's what I did. I may not have got another chance,” Pliskova said.
Elina Svitolina too reached the last 16 with a straight sets win over Shelby Rogers. Svitolina will be joined by Daria Kasatkina who reached the last 16 of a major for the first time after routing French Open champion Jelena Ostapenko 6-3, 6-2.