The Swiss came through 6-2, 6-3 to record his third consecutive win over the Spaniard for the first time in his career. It was Federer's second win over Nadal this season after earlier beating him in the final of the Australian Open to claim his 18th Grand Slam title.
It was the 36th meeting between the pair and for the first time in 13 years they were meeting prior to the quarter-finals in a tournament. Their last came in the third round of the Miami Masters in 2004, which was their first ever meeting.
Federer continued his aggressive brand of tennis that served him well in Melbourne and the Spaniard had to answer the Swiss maestro's brilliant shot-making. Nadal has often targeted the 18-time Grand Slam winner's backhand during his previous wins, but it was the weakness that proved to be the main weapon in his most recent triumph.
The 35-year-old broke Nadal twice to take the opening set in just over half an hour and was relentless in his pressure in the second. It was a similar situation when he broke Nadal first in the third game and then again when the Spaniard was serving to stay in the match in the ninth game.
"I did very well today, I'm so pleased I'm able to step into the court and play super aggressive," Federer was quoted as saying on BBC Sport. "Coming over the backhand has been part of that."
The Swiss ace will face Nick Kyrgios in the quarter-finals after the Australian recorded his second consecutive victory over world number two Novak Djokovic, who was looking for his fourth straight BNP Paribas Masters title.
The 21-year-old ended Djokovic's Indian Wells winning streak that began in 2013 and made it 2-0 in their head-to-head count after beating him in the quarter-finals at the Telcel Mexico Open in Acapulco earlier in the month. Similar to his previous win, he toppled the 12-time Grand Slam winner in straight sets 6-4, 7-6.
Djokovic, who is known for his return game, had no answer to the Australian's serve, which was flawless throughout the match. The Serb was unable to fashion even one breakpoint during the entire duration of the match.
The world number two had admitted that tennis is not his number one priority at the moment, but his lack of form will be a cause for concern as he has not gone past the quarter-finals in any tournament after his win at the season opening Qatar Open.
"I am serving really well, that is creating chances for me to put pressure on their service games," Kyrgios said after the win, as quoted by BBC Sport. "My mentality is improving and I am trying really hard to fight for every point and just compete."