Federer, who swept the New York hardcourt crowns from 2004-08, and Nadal, whose 2010 US Open title completed a career grand slam, could meet in the quarter-finals.
"I hope I'm going to be there,'' Federer said. "The biggest mistake I can do is focus on Rafa right now. Clearly I would love a match with Rafa.''
With a career-best 17-match hardcourt win streak, Nadal, 27, will next play Croatian Ivan Dodig, who upset him in their most recent meeting in Montreal in 2011
Federer, 32, next faces Frenchman Adrian Mannarino, who defeated US 26th seed Sam Querrey in four sets.
Spanish fourth seed David Ferrer and French eighth seed Richard Gasquet kept rolling towards a potential quarter-final by beating countrymen, Ferrer dispatching Roberto Bautista Agut 6-3 6-7 (5-7) 6-1 6-2 and Gasquet dumping Stephane Robert 6-3 7-5 7-5.
Other second-round winners include 10th seed Milos Raonic, John Isner (13), Janko Tipsarevic (18), Tommy Robredo (19), Philipp Kohlschreiber (22) and Feliciano Lopez (23).
On the women's side, defending champion Williams downed 77th-ranked Galina Voskoboeva 6-3 6-0, and Belarus second seed Azarenka beat Canada's Aleksandra Wozniak 6-3 6-1.
But Italian fourth seed Sara Errani made a tearful exit, the 2012 semi-finalist and French Open runner-up falling to friend and compatriot Flavia Pennetta 6-3 6-1.
"It was difficult,'' Errani said. "The worst thing was the 'fight'. Normally it's the best thing I do on the court and today it was not good. I don't know why. I think it's the pressure. Everything was very difficult for me.''
World No 1 Williams, who would become the oldest US Open women's champion at 31 if she repeats, advanced her quest for a 17th grand slam title and fifth Open crown with ease. She faces Russian-born Kazakh Yaroslava Shvedova next.
Two-time Australian Open champion Azarenka, who beat Williams earlier this month in the Cincinnati final, booked a match against French 26th seed Alize Cornet for a spot in the last 16.
Other winners include No.8 Caroline Wozniacki, Petra Kvitova (7), Angelique Kerber (8), Jelena Jankovic (9), Roberta Vinci (10), Ana Ivanovic (13), Maria Kirilenko (14) and Sabine Lisicki (16).
-AAP