Federer advanced to his eighth straight Basel final with the victory against the 40th-ranked Canadian.
The sixth-ranked Federer faltered when serving for the match at 5-3 in the second set, and fell behind 3-1 in the third before rallying.
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 is a five-time champion at Basel and seeks to reclaim the title taken by the fifth-ranked Argentine last year.
"It's always a pleasure for me," del Potro said about the prospect of playing Federer. "I know all the people are waiting for that final and it would be like a rematch for him."
If Federer wins Sunday, he'll secure his place at the ATP Finals in London.
He'll also close out his most difficult season, which was beset by back injuries and defeats to lower-ranked opponents. The 32-year-old Federer improved his season record to 40-13, the fewest wins since a 49-21 mark in 2001 when he turned 20.
In a dramatic third set, Federer's wayward groundstrokes allowed Pospisil to break for a 3-1 lead.
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 clinched victory with a powerful service winner and raised both arms in triumph after 2 hour, 40 minutes.
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 Federer.
Asked about Federer's comments this week that the Swiss star needed to improve, del Potro suggested: "It doesn't matter what he says -- it's Roger Federer and he is playing in his hometown."