The five-time hometown champion is now into his 11th career final at the St Jakobshalle, the event where he got his start in the sport two decades ago as a ballboy.
"I'm clearly relieved, it was always going to be a match like this against him," said Federer, now 12-1 over man-mountain Karlovic.
"You always have a good feeling getting out of a match like this as the winner."
It took a mighty effort from the 33-year-old world number two who achieved the break he needed in the third game of the final set.
Federer landed a return at the Croatian giant's feet which Karlovic netted to hand over three break points.
Karlovic then double-faulted as Federer broke for 2-1 to wild screams from a partisan crowd in excess of 9,000.
The end eventually came when the top seed leapt for an overhead smash for three match points. One was all he needed, with a volley winner sealing a Sunday final with Belgian outsider David Goffin.
"He served the best he ever has against me," said Federer. "I'm very impressed with how big he served.
"I never expected to break in that third set. I was very happy to get that and bring it home."
Top seed Federer added: "It's unbelievable how successful I've been at this tournament.
"I'm clearly overjoyed and hope to play another good match and enjoy the final. I really felt the crowd support today.
"The (Basel) streak is great, but I'm only focussed on trying to win tomorrow."
The 28th-ranked Goffin ended the dream run of teenager Borna Coric, the conqueror of Rafael Nadal, 6-4, 3-6, 6-3 in his semi-final.
Croatian Coric, 17, and ranked 124th, was brought down to earth less than 24 hours after he won the match of his career, defeating 14-time major winner Nadal in the quarter-finals.
Federer is expecting a challenge from a finals opponent with nothing to lose and running with huge current confidence. The Swiss won their previous meeting in the Roland Garros fourth round two years ago.
"He's a very talented player who has all the shots," said 17-time Grand Slam winner Federer. "It will be a difficult final. When you are winning so much, you almost forget how to lose."
Goffin, a low-key character at the best of times whose baby-face disguises a killer instinct on court, credited his steady, calm demeanour with getting him through against Coric.
"I'm pretty calm on and off the court," said the Belgian.
"I think my personality helps me manage on the big points. I'm really happy to have won and reached the final," said the seventh seed who needed four match points to close out Coric.
"It's never easy to finish a match. I was nervous and I'm pleased that I won."
Story continues below…
Goffin, who has exploded into form since Wimbledon with a 43-2 record, has this season won ATP titles at Kitzbuhel and Metz as well as four trophies on the lower-level Challenger circuit.
"It's a great period for me, I've been playing better and better in each match, I have the confidence now and that is helping me. I'm able to just keep winning right now."
The Belgian won the first set Saturday but found himself level-pegging in the second after Coric struck back with his fifth and sixth aces to earn the second set.
In the third, Goffin broke for 3-1 and eventually earned three match points from a Coric error.
The Belgian double-faulted on one of his winning opportunities but secured the win on his fourth match point from a Coric return over the baseline.
Goffin, 23, earned the first top 10 win of his career in the quarter-finals as he defeated number nine Milos Raonic.