Federer, who won three straight for the first time in the 36-match rivalry, used the same aggressive game plan he used to defeat Nadal in the Australian Open in January.
The 36-year-old Federer needed only 34 minutes to win the first set, finishing it off with a serve-and-volley winner. He broke Nadal to go up 2-1 in the second set and won the match with a backhand return winner into the corner.
Federer meets 15th-seeded Nick Kyrgios in the quarterfinals. The Aussie ended three-time defending champion Novak Djokovic's reign at Indian Wells by knocking off the world's second-ranked player 6-4, 7-6 (3).
Djokovic won a tournament-record 19 consecutive matches at Indian Wells, but once again was unable to solve the big-serving Kyrgios, who also dispatched the Serbian star in straight sets in Acapulco less than two weeks ago.
Djokovic was seeking his sixth title at Indian Wells, but Kyrgios derailed his chances by unleashing 14 aces while never facing a break point.
Kyrgios broke Djokovic in the opening game and closed out the first set with his seventh ace of the match. Djokovic held a 5-4 lead in the second but Kyrgios easily held and rode a pair of big serves in the tiebreak, including one clocked at 141 mph, to end the match.
American Jack Sock, seeded 17th, also advanced to the quarterfinals by rallying for a 4-6, 7-6 (1), 7-5 victory over Tunisia's Malek Jaziri in a match that lasted more than 2 1/2 hours.
Sock faces fourth-seeded Kei Nishikori of Japan in the quarterfinals. Niskikori overpowered American Donald Young 6-2, 6-4 in his fourth-round match.