Tomas Berdych staged a dramatic fightback to overpower David Ferrer and finish top of Group A at the ATP World Tour Finals.
Ferrer won the first set and was twice a break up in the second, only to suffer a startling collapse in front of a captivated crowd at London's O2 Arena.
Berdych took advantage in ruthless fashion to win 3-6 7-5 6-1 and book a semi-final against Jo-Wilfried Tsonga at 2000 GMT on Saturday.
Ferrer had already qualified for the knockout stage but, as runner up, he will now have to play Group B winner Roger Federer at 1400 GMT.
The result sees world number one Novak Djokovic eliminated from the season-end championship.
He follows second-ranked Rafael Nadal and third-ranked Andy Murray out of the event, leaving Federer as the only member of the 'big four' to advance.
But none of that will matter to Berdych, who looked certain to be heading out until Ferrer's game inexplicably fell apart to gift him a morale-boosting triumph.
The Czech had lost five of their seven previous meetings, including each of the last four, and in the early stages it was easy to see why.
He could not cope with Ferrer's precision, variety, movement or belligerence - becoming visibly frustrated as the Spaniard returned ball after ball.
A gorgeous drop volley helped Ferrer move 2-1 ahead and after holding to love with an air of invincibility, he earned the chance to strike in game eight.
Berdych was struggling to land his first serve and he found himself faced with two break points, the first of which was taken as he put a forehand wide.
Ferrer served out with a drive volley and an unstoppable smash. The end was already in sight.
Until now, Ferrer had lost only one of the 45 matches in which he has taken the first set this year.
And it seemed that record would become 46-1 when Ferrer buried a backhand pass to break in game three of the second set.
However, Berdych decided to go for broke and began rushing to the net at every opportunity. His volleying suddenly clicked.
A purposeful put-away brought him level for 2-2 and although he flicked a forehand long to put Ferrer back in the ascendancy, there was again an immediate response.
Ferrer was starting to look tetchy and distracted, his first-serve percentage dropping below 40% and his groundstrokes lacking penetration.
A netted backhand and a lob that sailed long turned a 30-15 lead into 3-40 and set point. Ferrer drilled an anxious backhand beyond baseline and Berdych was back.
Ferrer opted for a luminous pink shirt at the changeover but if he hoped it would either inspire him or knock Berdych out of his stride, he was badly mistaken.
The seventh seed opened the decider with a love hold and then broke serve by the same scoreline when his opposite number sent down an untimely double-fault.
Another double made it 4-0 and a 135mph ace sealed Berdych's latest love hold in game five.
Ferrer did manage to get his name on the board but it was scant consolidation. He had snatched defeat from the jaws of victory.
The 29-year-old Ferrer, who has lost all 11 of his previous matches against Federer, said: "I will try to fight a lot. I've never beaten Roger, and I hope tomorrow I can change that."