Roger Federer fought past Canada's Vasek Pospisil, taking nearly three hours on Saturday to earn a 6-3, 6-7 (3/7), 7-5 victory which put him into the final at his home Swiss Indoors.
The five-time champion will bid for a sixth trophy on Sunday when he faces holder and top seed Juan Martin del Potro, who overcame a nose bleed and a stubborn Edouard Roger-Vasselin, 6-4, 4-6, 6-2.
Federer found himself in a battle with the number 40 Pospisil whom he beat in their first meeting in 2011.
The challenge was huge against the outsider, with Pospisil overcoming his nerves in the first set and turning the screws on the home favourite and 17-time grand slam champion until the end.
Federer served for a straight-set win only to lose serve as Pospisil kept up the battle, winning a second-set tie-breaker to bring on a deciding set.
That one was also a thriller, with the Swiss third seed finally able to end the 10-minute penultimate game after his opponent saved three break points but hit out on a fourth to trail 5-6.
Federer seized his opportunity a game later to the fervent cheers of his local crowd on his first match point.
He now needs only victory in the final to assure himself qualification for the ATP World Tour Finals for a 12th successive year.
"It was so special with the public today," said Federer, who has reached the Basel final for the eighth consecutive edition and now stands 10-1 in semis.
"They really help me in situations like this. It makes all of the hard training worth it."
Federer understandably called the contest "a good fight".
"I started getting nervous at the end of the second set (after serving for victory up a set and 5-3 only to lose serve before going down in the tiebreaker).
"But luckily I got better again midway through the third. How great would it be to be 25 again," he said after seeing off his 23-year-old opponent. "Time passes so fast.
"Playing Del Potro (whom he leads 13-4 in their series) will be another challenge. He's playing well and is the holder, but I'm feeling good with my game and looking forward to it."
Del Potro was cruising to an apparent easy win with a lead of a set and 4-3 against another outsider in Roger-Vasselin when the wheels briefly came off his game.
Instead of serving into a 5-3 lead, Del Potro instead double-faulted for break points and lost serve as he let the Frenchman back into the contest.
The 65th-ranked Roger-Vasselin, playing only his second semi-final of the season, took advantage, holding for a 5-4 lead and breaking the Argentine again to take the set after Del Potro saved a first set point with his fifth ace but hit out on a second.
The seed steadied in the final set, taking a 4-0 advantage and eventually finding a match point with a forehand down the line. A backhand to the net from his opponent ended the drama after just over two hours.
"I made a lot of mistakes at the end of the second set," said Del Potro, already qualified into the year-end World Tour Finals in London starting a week from Monday.
"He was right there and took his opportunities. He had nothing to lose and it was a tough match for me.
"I had all the pressure on me as I was the favourite. But at the end I managed to find my game again and played well. I'm just glad to be into a another final here."