Roger Federer saved four match points to win an epic all-Swiss battle against Stan Wawrinka and set up a showdown with Novak Djokovic at the ATP World Tour Finals.
All week the tournament has seemed destined to come down to a meeting between the world's top two players but Wawrinka very nearly ruined the script.
The Australian Open champion served for the match at 5-4 in the decider and had another chance in the deciding tie-break but Federer hit back to clinch a 4-6 7-5 7-6 (8/6) victory.
Earlier, Djokovic moved to within one win of making it three consecutive unbeaten titles by beating Kei Nishikori.
Federer said: "I think I got lucky tonight. Stan played better from the baseline and that usually does the job on this court. 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. It's going to be tough but I'll give it a shot."
Wawrinka was on form from the start in front of a lively crowd and a couple of big forehands earned him the early break for 2-1.
It was the forehand doing the damage again two games later and, although he blinked serving for the set the first time, he had no trouble second time around.
The second set was tense and ultra competitive, everything the round-robin stages were not.
Federer had three chances to break serve in the sixth game but missed them all and both men survived close service games until the Swiss number one broke through in the final game.
He had his compatriot to thank, with Wawrinka netting a simple overhead to slip to 0-40 and then missing a backhand.
But the third seed moved a quick break ahead in the deciding set, with Federer unhappy after not hearing an overrule from the umpire on a Wawrinka shot that was later shown to be out.
The incident happened on the first point of the game but Federer did not realise until he was 0-40 down.
The two friends had become mortal enemies and frustration was bursting out of Federer when he missed two break points at 3-4.
It looked like his chance had gone but three times he saved match points at 4-5 - Wawrinka serving and volleying each time - before eventually breaking back to level at 5-5.
Wawrinka then had two chances to break again but missed them both and the match headed to a deciding tie-break.
After losing the second point, Wawrinka began to cramp, and the end looked nigh at 5-3 to Federer, but three points in a row gave his opponent a fourth match point.
A good serve took care of that, and two precision drop volleys earned the second seed the most dramatic of victories after two hours and 48 minutes.