Federer broke Nadal four times in advancing to the quarterfinals in just over an hour.
Although Nadal owns a 23-13 lead in their series, Federer has won the past three in a row, including an epic comeback in the Australian Open final two months ago.
Federer broke Nadal to open the match in front of a packed Stadium 1 crowd. Federer faced just one break point on his serve in the match, but he recovered with a big serve and two winning backhands to go up 2-0 in the first set.
Nadal wasn't too shabby either, serving three love games. But Federer's shotmaking was superb, frequently kissing the lines off both sides.
More From This Section
The four-time Indian Wells winner was crafty, too. Leading 5-1, Federer moved in quickly on Nadal's second serve, surprising the Spaniard, whose forehand sailed long.
The two superstars hadn't played each other before the quarterfinals of an event since 2004 when they met in the third round at Miami. Wednesday's match was just the fifth time they weren't opposing each other in a final.
Another one of tennis' Big Four went down, too. Novak Djokovic's 19-match winning streak at the desert tournament ended in a 6-4 7-6 (3) loss to Nick Kyrgios.
Djokovic joined Nadal and top-ranked Andy Murray, who was upset in the second round.
Kyrgios beat Djokovic for the second time in two weeks, having earned a straight-set victory over the world's No. 2 player at Acapulco on March 2.
"Conditions like today where the ball travels through the air very fast and it bounces very high, it's a gamble," Djokovic said. "On his first serves, to try to anticipate and read his serve, where he's going to go 140 miles per hour down the T and also pretty good angle wide, it's hard to position yourself well."
"The run was amazing," Djokovic said. "It had to end at some stage. Unfortunately, it was today."
Kyrgios advanced to the quarterfinals, where he will face Federer. The 15th-seeded Australian hit 14 aces, with his fastest serve clocking 141 mph, and won 86 percent of his first serve points.
Also joining Kyrgios in the quarterfinals were No. 4 seed Kei Nishikori, who defeated Donald Young 6-2 6-4; 17th-seeded Jack Sock, a 4-6 7-6 (1) 7-5 winner over Malek Jaziri; No. 21 Pablo Carreno Busta, who beat qualifier Dusan Lajovic; and No. 27 Pablo Cuevas, who outlasted 11th-seeded David Goffin 6-3 3-6 6-3.