The Spanish star outpaced Croatia's Ivan Dodig 6-4, 6-3, 6-3, improving to 18-0 on hard courts this season in his quest for a second New York title.
Nadal's previous U.S. Open win came in 2010. He now goes on to face 22nd-seeded Philipp Kohlschreiber of Germany, who advanced with a 6-4, 3-6, 7-5, 7-6 (7-5) upending of 13th-seeded American John Isner.
Seventh-seeded four-time champion Federer, meanwhile, also cruised in his second-round match, taking apart Frenchman Adrian Mannarino 6-3, 6-0, 6-2.
Also advancing Saturday was fourth-seeded David Ferrer, who had to work much harder to get past Kazakhstan's Mikhail Kukushkin 6-4, 6-3, 4-6, 6-4.
His next opponent will be No. 18 Serb Janko Tipsarevic, who regrouped after a rough first set to overcome American Jack Sock 3-6, 7-6 (7-1), 6-1, 6-2.
Tenth-seeded Canadian Milos Raonic moved on as well, bouncing No. 23 Feliciano Lopez of Spain 6-7 (4-7), 6-4, 6-3, 6-4, while eighth-seeded Richard Gasquet of France was ahead of No. 32 Dmitry Tursunov, 6-3, 2-6, 6-4, 4-2, before the Russian retired in the fourth set.