Federer is now ranked No.5 going to the second leg of the "Sunshine Double" of Indian Wells and Miami.
Federer next faces compatriot Stan Wawrinka, while Nadal will take on Argentina's Diego Schwartzman.
Sharapova has decided to split with her coach Groeneveld following her shock first round exit from the Indian Wells.
The former world number one Sharapova was one of the tournament's major attractions after missing the last two events.
Sania Mirza and Barbara Strycova crashed out of the BNP Paribas Open after going down in straight sets in the quarters.