Nadal, seeded fifth, won 6-3 7-5 and will next face long-time rival Federer or American Steve Johnson.
The Swiss beat Nadal in the Australian Open final in January to win his 18th Grand Slam title.
Second seeds Novak Djokovic and Angelique Kerber are among those in action later on Tuesday.
In earlier matches, unseeded American Donald Young beat French 14th seed Lucas Pouille 6-4 1-6 6-3 in the men's draw, while Japan's fourth seed Kei Nishikori swept past Frenchman Gilles Muller 6-2 6-2.
Australian 15th seed Nick Kyrgios beat 18th seed Alexander Zverev of Germany 6-3 6-4.
In the women's draw, American 12th seed Venus Williams beat Peng Shuai of China 3-6 6-1 6-3, and Czech third seed Karolina Pliskova led Timea Bacsinszky 5-1 when the Swiss retired. - BBC -