After a week of one-sided group stage action at London's O2 Arena, the season-ender burst to life with world number one Djokovic battling past Japan's Kei Nishikori after a mid-match meltdown before Federer saved four match points in a near three-hour duel with compatriot Wawrinka.
Federer eventually prevailed 4-6 7-5 7-6(6) against the man he will join forces with when Switzerland take on France in next week's Davis Cup final.
Djokovic, bidding for a third consecutive season-ending title having already secured the number one ranking, beat Asian trailblazer Nishikori 6-1 3-6 6-0 after losing his cool with another capacity crowd at the O2 Arena.
ATP World Tour Finals
Bryans claim fourth Tour Finals title
16/11/2014 AT 19:06
The real drama was saved to last, however.
Federer, sublime in a 6-0 6-1 thrashing of home favourite Andy Murray in his final group match on Thursday, was the big favourite to claim a 15th victory in 17 career clashes with Wawrinka, but he was in for a rollercoaster ride.
Australian Open champ Wawrinka seemed determined to tear up the script, which had Federer and Djokovic lined up to contest the final match of the ATP season on Sunday.
He outplayed 17-times grand slam champion Federer in the opening set and went toe-to-toe in the second before cracking in the 12th game when a missed smash gave Federer three set points.
One was enough.
Federer was riled by a line call when he dropped serve in the first game of the decider and the 33-year-old's mood darkened further when, serving at 4-3, Wawrinka saved one of two break points with a fluky volley off the frame.
But Wawrinka will have nightmares about 10th game.
Match point arrived but he watched a Federer forehand whistle past him. Another came, and this time Wawrinka netted a feeble volley. Wawrinka's nerve failed him again on a third match point when he could only spoon a volley, which Federer fizzed back past him before going on to win the game.
A tiebreak was needed to settle it and Wawrinka eeked out another match point, but this time his service return went long.
With the 17,500 fans, many in Swiss red and wearing Federer masks, making a deafening din, Federer had the coolest head in the cavernous arena, taking the next two points, and the match, with sumptuous drop volleys.
"I think I got lucky tonight. Stan played better from the baseline and that usually does the job on this court," a relieved Federer said. "But I kept fighting. It's tough but I'm thrilled to be in another final in London."
He will now do battle with Djokovic for a 37th time, though he has precious little recovery time.
That said, Djokovic was complaining of "mental exhaustion" after ending Nishikori's impressive debut at the Tour Finals.
The Serb was rattled by a mid-match onslaught from the Japanese, who came back from a poor start to dominate the second set, only for his challenge to fizzle out in the decider.
After dropping only nine games in group stage wins against Marin Cilic, Wawrinka and Tomas Berdych, it looked like plain sailing again for the Serb but a double-fault, loudly cheered by the crowd who wanted a Nishikori fightback, threw Djokovic off track early in the second set.
He gestured sarcastically to the fans and admitted his tetchy loss of focus could have cost him dear.
"I mean, look, at the end of the day I cannot blame the crowd," Djokovic told reporters.
"The crowd has a right to do what they want, to cheer for whoever they want. Some individuals were going over the line but I lost concentration.
"I lost the break because of that. I allowed myself to be in the situation to lose the set, maybe even lose the match."
ATP World Tour Finals
Bryan brothers reach year-end final in style
15/11/2014 AT 20:04
ATP World Tour Finals
Tetchy Djokovic blames exhaustion for Nishikori scare
15/11/2014 AT 19:07