Roger Federer battled to a brilliant three-set win over Juan Martin Del Potro to set up a semi-final clash with Rafael Nadal at the World Tour Finals.
The Swiss, 32, won 4-6 7-6 (7-2) 7-5 and will face world number one Nadal in the last four at 14:00 GMT on Sunday.
Federer trailed in all three sets and came back from 3-0 down in the decider against fourth seed Del Potro.
Novak Djokovic beat Richard Gasquet 7-6 (8-6) 4-6 6-3 and faces Stanislas Wawrinka in Sunday's second semi-final.
The world number two had already won Group B and, despite losing a set against Gasquet for the first time since 2007, claimed his 20th consecutive win in two hours and nine minutes.
"I knew coming into this match that I qualified for the semi-finals, and even though I really wanted to perform at my best, Richard came out really aggressive and I didn't move too well," said Djokovic.
"Richard has one of the best backhands on the tour. It was a pleasure to play against him and I wish him all the best."
A capacity crowd had gathered at the O2 Arena, many of them decked out in the Swiss colours, to see if Federer could repeat last week's win over Del Potro in Paris. They were not to be disappointed.
Asked afterwards how he had felt to fall behind for a third time in the final set, Federer said: "I was probably slightly angry more than thinking it's going to be over soon.
"It's one of those moments today - because I kind of fought back the whole match, the first, second set - 'Here we go again.' Once on even terms, I was able to play a little bit more freely.
"For the first time I was almost feeling like I was kind of in the lead. [It was a] great finish. To get the victory was a great feeling, so I was very happy."
The six-time champion started poorly, with two errors on his favoured forehand side seeing him slip to 0-40 in the first game and a third, wild effort giving up the break.
Del Potro took command, cracking one thunderous forehand return on the way to the double break and a 5-1 lead, before Federer then produced a 10-minute spell reminiscent of his best days.
The 17-time Grand Slam champion cut the deficit to 5-4, thanks in part to his now functioning forehand, and threatened to level with two more break points in game 10, but Del Potro passed the test of nerve admirably.
The Argentine sent down two heavy first serves out wide to get out of trouble and clinched the set, dampening the growing excitement among the Federer fans.
That optimism became something closer to gloom when their man netted a backhand to fall a break down early in the second, prompting a rare outburst of frustration from the man himself, but once again Federer found his game when behind.
From 3-1 down, 12 points in a row saw Federer sweep back into contention, and as so often in the past his more attacking instinct held sway in the tie-break.
The last six matches between the pair had gone the distance, and the pattern repeated itself in a thrilling climax to the contest.
Once again Federer recovered a deficit, moving brilliantly in defence as he came back from 3-0 down to level, and now hitting more confidently he took on the Del Potro serve at 5-5 to break when the Argentine fired long.
The drama was not over, Del Potro earning a break-back point as Federer tried to serve it out, but he netted a backhand and the seven-time Wimbledon champion closed out one of his best wins of the year with an ace.
Del Potro admitted: "I'm a little disappointed about my match today. I think I got two chances to win - I broke his serve in the second set and in the third.
"But also he played great when I was up in the score, and he deserved to come back in both sets."
|Juan Martin Del Potro||1-2||4-5||48-48|