The scores of the match were 7-6 (7-5) and 7-6 (7-5).
Sunday, he will face Finland's Jarkko Nieminen, a 7-6 (7-4), 6-2 winner against Marcos Baghdatis of Cyprus.
Federer was unable to break the serve of the 6-foot-10 inch Karlovic at key spots, but improved to 51-2 in his last 53 matches, and recorded the 545th match win in his career.
He was playing before another packed and enthusiastic home crowd, and will play in this event's final a fourth time.
Karlovic had 16 service aces to 10 by Federer, but failed to convert two critical break points in the final two sets.
"It will be a great experience to play (Federer) on his home court," Nieminen said. "Sometimes it feels like he is not a human, but he is and every match starts from 0-0."