Fifth seed Nadal beat fellow Spaniard Fernando Verdasco 6-3 7-5.
Switzerland's Federer, who won his 18th Grand Slam title with a five-set victory over Nadal in January, beat American Steve Johnson 7-6 7-6.
Novak Djokovic beat Juan Martin del Potro, while Angelique Kerber, who is set to become world number one, is out.
The German, who is guaranteed a return to the top of the rankings on Monday following Serena Williams' withdrawal from Indian Wells and the Miami Open, lost 3-6 3-6 to Russian Elena Vesnina.
Serb second seed Djokovic was hugely impressive as he won the deciding set 6-1 against Argentine Del Potro and he will play Australian 15th seed Nick Kyrgios, who earlier beat 18th seed Alexander Zverev of Germany 6-3 6-4.
"That's why I came here, to play against guys like Rafa," said Federer, 35, before a 36th meeting with Nadal, 30. "I'd better be excited now otherwise I came for the wrong reasons.
"I try to see it really as another opportunity to build upon something for the rest of the season.
"So regardless of Australia, winning or losing, I'm going to try to go out there and play free again. I think it's really important."
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.
American 17th seed Jack Sock edged a third set tie-break to beat Grigor Dimitrov of Bulgaria 3-6 6-3 7-6.
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.

The total - that includes on and off-street parking and penalty charges minus running costs - means it is the third year in a row the figure has increased.
Of the 22 councils, 19 made a profit, with Cardiff (£3.5m) the biggest.
Three councils lost money on parking - Flintshire (£423,000), Blaenau Gwent (£310,000) and Torfaen (£81,000).
Before running costs were taken off, the local authorities had a combined parking income of £35.8m - a 5.6% increase on the previous 12 months.
The RAC Foundation takes official returns given to the Welsh Government by each local authority and analyses them.
Its director Steve Gooding said the figures "up sharply again" could reflect "a recovering economy with people using their cars more".
Earlier this month, the Wales Audit Office said Welsh councils could raise much-needed cash by charging more for services.
However, it cautioned against some rises, citing the potential for increased car parking fees to stop tourists and shoppers visiting town and city centres.
Mr Gooding called for profits made from parking to be ploughed back into transport projects - including the ongoing campaign to tackle potholes.
He said while towns and cities should not be dominated by cars, more than 80% of employees in Blaenau Gwent, Neath Port Talbot and Torfaen rely on their vehicles to get to work -  some of the highest levels in the UK.
Swansea (£2.4m) and Gwynedd (£1.4m) recorded the second and third highest profits, while Monmouthshire's system was the most efficient - with £490,000 spent and £1.42m brought in.
Roger Federer and Rafael Nadal have set up a fourth-round tie at the BNP Paribas Open in Indian Wells - a re-run of this year's Australian Open final.
[NEXT_CONCEPT]
Car parking charges made Welsh councils a combined profit of £13.8m in 2015/16, figures from the RAC Foundation show.