It was the first match at Key Biscayne in two years for Federer, who took a spring layoff in 2013.
The 32-year-old Federer has looked rejuvenated and climbed to No. 5 in the rankings this week. While he had trouble with Karlovic's big serves, the 6-foot-11 Croat had no chance when returning serve.
Federer won 49 of his 52 service points. In a match with few rallies, he committed just three unforced errors.
The longest point was the last one. When Karlovic pushed a backhand into the net on the 10th stroke, Federer hopped happily in celebration and threw a fist.