Both players matched each other stride for stride in the opening set and it took a moment of magic from Federer, who produced a stunning return late in the tie-break, allowing him to serve to secure the opening set 7-6.
Karlovic continued to serve well in the second set but Federer's quality began to shine through as he secured his first break point of the match and with it, a two-set lead.
Federer missed the chance to break early in the third with Karlovic holding his serve well, but the former world number one proved too strong for the 32-year-old Croatian as Federer broke to go ahead 3-1.
He closed out the final set in style with a powerful serve to secure his passage into the next round.
Federer has won the Australian Open four times.