Federer advanced to his eighth straight Basel final with a 6-3, 6-7 (3), 7-5 victory over the 40th-ranked Canadian.
The third-seeded Federer faltered when serving for the match at 5-3 in the second set. He fell behind 3-1 in the decider before rallying in front of a capacity crowd of 9,200 at St. Jakobhalle.
"Watching is actually worse than playing itself," said Federer, describing the atmosphere as a "roller-coaster ride."
"It's almost nice to be part of it even though, in the moment, it could have been easier," he added.
Earlier, defending champion del Potro also let the second set slip away against an unseeded opponent before beating Edouard Roger-Vasselin of France 6-4, 4-6, 6-2.
Federer, a five-time champion at Basel, is looking to reclaim the title taken by the fifth-ranked Argentine last year.
"It's always a pleasure for me," the top-seeded del Potro said, referring to another meeting with Federer. "I know all the people are waiting for that final and it would be like a rematch for him."
With a victory Sunday, the sixth-ranked Federer will secure a spot in the ATP Finals in London in just more than a week.
This has been his most difficult season, one beset by back injuries and startling defeats to lower-ranked opponents. He improved his season record to 40-13, his fewest wins since he went 49-21 in 2001, the year he turned 20.
In a dramatic third set, wayward groundstrokes from Federer allowed Pospisil to break for a 3-1 lead.
"I was maybe a bit down, a bit tough with myself at the beginning of the third," Federer said. "I think that is also why I got broken. It had nothing to do with actual playing."
Federer reclaimed the break immediately, but had to fend off another break chance for Pospisil before holding at 4-4. At 5-5, Federer wasted three break chances before finally leading in the set when Pospisil fired a forehand long.
Federer won with a powerful service winner and raised both arms in triumph after the 2-hour, 40-minute semifinal.
"Any winning match is a good thing right now. It's not like I have overplayed this year," he said.
Del Potro has a 4-13 career record against Federer, though he has won their past two meetings, both on indoor hard courts at Basel and London a year ago. He also clinched his only Grand Slam title, the 2009 U.S. Open, against the Swiss star.
Asked about Federer's comments this week that he needed to improve, del Potro suggested: "It doesn't matter what he says -- it's Roger Federer and he is playing in his hometown."
Del Potro also spent more than two hours on court and acknowledged some lapses.
"I was frustrated because of missing my forehands and making a lot of double-faults," he said.
Still, del Potro refocused quickly after giving up a 4-3 lead with a service break in the second set, as 65th-ranked Roger-Vasselin won three quick games to even the match.
Del Potro, who had three straight-sets victories to reach the semifinals, raced to a 4-0 lead in the third and converted his first match point when Roger-Vasselin returned a serve long.