The world number six edged fellow Spaniard Fernando Verdasco 6-3, 7-5 to keep his challenge for a first title of 2017 on course.
The 14-time Grand Slam champion hasn't won a hard court crown since 2014.
He'll face the winner of Tuesday's match between American Steve Johnson and Federer -- who beat the Spaniard in an epic Australian Open final in January to claim an 18th Grand Slam title.