Federer, a six-time champion, fought for nearly three hours to reach a ninth final in a thrilling 4-6, 7-5, 7-6 (6) win over his Davis Cup teammate Stan Wawrinka. The 17-time Grand Slam champion will face the top-ranked Novak Djokovic on Sunday.
Having swept his group imperiously, Federer was the favourite, but met strong resistance from the Australian Open champion, who failed to cope with nerves in the end.
Wawrinka had Federer under constant pressure from the baseline, and kept his composure until he served for the match at 5-4 in the deciding set. He dropped serve following three clumsy approaches to the net on match points.
"For sure that game at the end I was nervous," admitted a devastated Wawrinka. "You make some choice, especially when you're tired, when you're nervous. Just wanted to go for it and not wait for mistake."
Federer saved the fourth match point with a service winner in the tiebreak then converted his first chance to seal the semifinal with a drop shot volley that Wawrinka could not return.
"I got lucky tonight. Stan played better from the baseline and that usually does the job on this court," Federer said. "But I kept fighting. It's tough but I'm thrilled to be in another final in London. Novak is playing great tennis. It usually brings the best out of me."
Federer and Wawrinka will be teaming up next week in the Davis Cup final against France, but Wawrinka said he is not sure how he will react after his cruel loss.
"I can either be destroyed or bounce back," said the Swiss.
"Hopefully he is not too disappointed and will recover soon," said Federer. "It would be good for both of us."
A two-time defending champion at the O2 Arena, Djokovic overcame a lapse of concentration to beat Kei Nishikori 6-1, 3-6, 6-0 and advance to a third straight final.
Wawrinka and Federer treated their fans with some superb winners and, for the first time this week, nerve-racking suspense was on the bill.
Wawrinka took all the risks on Federer's serve, a strategy that paid off when he broke in the third game with two consecutive forehand winners. Serving well and playing deep, Wawrinka limited Federer's opportunities to come to the net.
The second set was also suspenseful, with Federer coming out on top after breaking his compatriot at love in the 12th game.
Wawrinka broke immediately at the start of the decider and held until he served for the match at 5-4. He crumbled, and was punished by Federer on his match points.
Djokovic also dropped his first set of the tournament against Nishikori. The Serb, who sealed the year-end No. 1 spot after finishing unbeaten in his group, lost his focus early in the second set after being angered by a partisan crowd.
Djokovic's game dropped off suddenly when he let Nishikori back in the match with a double fault that the crowd applauded. The Serb applauded in return with irony and shook his head in disbelief.
"The crowd has a right to do what they want, to cheer for whoever they want," Djokovic said. "Some individuals that were going over the line throughout the whole match, some provocations that I usually don't react on, but I did. It was my fault. Hopefully tomorrow it will not happen."
Nishikori failed to seize his chance at the start of the third set. The turning point came in the first game, when Djokovic — who had lost just nine games in his three previous matches — faced two break points at 15-40. Nishikori hit two consecutive unforced errors as the momentum swung the Serb's way. Djokovic showed no mercy, extending his indoor unbeaten run to 31 matches.
Djokovic, who beat Federer in the Wimbledon final, admitted he was "exhausted" after the match.
"But knowing just that tomorrow is the last match of the season, I'm sure that I will find any necessary drop of strength, mental and physical, to give it on the court."Suggest a correction