Federer, a two-time Miami champion, wiggled past Serra in a pair of tiebreaks, 7-6 (7-2), 7-6 (7-3), using six aces to complete the match in 1 hour, 32 minutes.
The contest was closer than expected, with each player posting three service breaks. Federer -- the reigning Australian Open, Wimbledon and French Open champion -- won back-to-back Miami titles in 2005 and 2006.
With the win, the Swiss star will match up against 16th-seeded Czech Tomas Berdych, who advanced by downing Argentine Horacio Zeballos 6-4, 7-5.
Several hours of inclement weather delayed Monday's action.
Seventh-seeded Croat Marin Cilic maintained his recent hot streak with a 6-3, 6-4 decision over No. 25 Marcos Baghdatis of Cyprus, needing only 76 minutes to post the win, while American Mardy Fish gained the round of 16 with a 7-5, 6-3 upset over 29th-seeded Feliciano Lopez of Spain.