Rafael Nadal saved a match point to beat Russian Daniil Medvedev and boost his hopes of a first ATP Finals title.
Nadal, bidding to keep his world number one ranking, could have been eliminated on Wednesday with defeat but beat the fourth seed 6-7 (3-7) 6-3 7-6 (7-4).
The Spaniard trailed 5-1 in the third set and saved match point on his serve at 5-2 before a stunning comeback.
The 33-year-old's hopes of progression to the semi-finals rest on his meeting with Stefanos Tsitsipas on Friday.
Greek Tsitsipas plays Alexander Zverev, who beat Nadal on Monday, later on Wednesday.
Nadal shows trademark fighting spirit
The last meeting between Nadal and 23-year-old Medvedev was September's US Open final, which the Spaniard won in five sets, and this match was almost as thrilling.
Both players looked beaten at times, Medvedev when he was distracted while he was losing the second set and Nadal when a double-break down in the decider.
Errors from Nadal and a resurgence from Medvedev at the start of the third set had led to the Russian racing into a 4-0 lead.
He had two break points for 5-0, and the match point two games later, but 19-time Grand Slam champion Nadal showed all of his trademark fighting spirit, roared on by the crowd at London's O2 Arena.
As Nadal clawed his way back, Medvedev lost focus again, sarcastically giving a thumbs-up to his box as games slipped away.
After losing five successive games, the Russian settled himself to force a tie-break and was on serve at 4-5 in the breaker before he dragged a short forehand wide to give Nadal a mini-break and match point.
Another gruelling rally followed but a Medvedev shot that was originally called in was ruled out by Hawk-Eye to hand Nadal victory after two hours 49 minutes.
More to follow.