(CNN) -- Roger Federer will play Novak Djokovic for the title at the ATP tournament in Basel after contrasting semifinal victories on Saturday.
World number one and home hero Federer saw off his old school friend Marco Chiudinell in straight sets, but Djokovic had to stave off three match points before completing a 6-7 7-5 6-2 victory over Radek Stepanek.
Federer was made to fight hard by his Swiss compatriot in the first set but he was always in control after taking a tense tiebreaker 9-7.
He dominated the second after an early break to run out a 7-6 6-3 winner as he bids for a fourth straight title in his home city.
World number three Djokovic reached his ninth final of the year but looked to be heading out against his Czech opponent as he trailed a set and 4-5 before mounting a fightback.
A double fault on his own service saw Serbian Djokovic facing the match points, but he calmly saved all three before taking control with a break to lead 6-5.
He duly served out to level and broke the dogged Stepanek twice in the decider to claim victory in two and a half hours.
The second seed admitted that he had been lucky to escape with the victory.
"I wasn't the better player on the court," he told the official ATP Tour Web site.
"My opponent today was playing quite good tennis and I still wasn't managing to find my rhythm in some returns.
"But, yet again, I found a way through and won another match, which is definitely a big success for me, reaching another final."
In other ATP Tour action, Britain's Andy Murray can claim his sixth title of the season after reaching the final in Valencia on Saturday night.
The top seed and world number four survived the loss of the second set to home hope Fernando Verdasco to win 6-3 2-6 6-3, breaking the Spaniard in the sixth game of the decider.
Murray will play Mikhail Youzhny after he won an earlier all-Russian semifinal against second seed Nikolay Davydenko 3-6 6-4 6-3.