Rafael Nadal demonstrated his fighting qualities once again to battle back from behind to beat Stefanos Tsitsipas and keep his ATP Finals hopes alive.
Nadal, who would have been eliminated with a defeat, won 6-7 (4-7) 6-4 7-5 in their final group match in London.
However, the Spanish top seed will still not make Saturday's semi-finals if defending champion Alexander Zverev beats Daniil Medvedev later on Friday.
With Tsitsipas already through, Zverev can join him at Nadal's expense.
Nadal, 33, is relying on a favour from Russian fourth seed Medvedev, who has been knocked out of the tournament by the 19-time Grand Slam champion's win.
Against Tsitsipas, Nadal produced another super-human effort to earn a victory which might ultimately prove fruitless.
After doing the same to beat Medvedev in their second round-robin match on Wednesday, a lifeless performance in his opener against Zverev could prove to be his downfall.
Nadal, who has never won the season-ending ATP Tour tournament, showed the grit, determination and never-say-die attitude that have been the hallmarks of his illustrious career to beat Tsitsipas in two hours and 52 minutes at the O2 Arena.
He was edged out of a tight first set in the tie-break before starting to hit more winners than unforced errors and tip the balance of the match in his favour.
Tsitsipas was the player under all the pressure on serve, facing nine break points in the match with Nadal needing to convert just one in each of the final two sets.
Nadal himself served supremely and did not face a single break point.
"I did all the things I could do, fighting until the end," Nadal told the crowd.
"If I am able to play in front of you tomorrow against Roger it will be a huge honour. If not, I hope to see you next year."
Who can qualify for the semi-finals?
With Austrian fifth seed Dominic Thiem having topped the other group and Swiss third seed Roger Federer finishing as runner-up, here are the possible scenarios for Saturday's semi-finals:
'I never thought at 33 I'd have this trophy' - Nadal finishes 2019 as number one
No matter what happened against Tsitsipas, Nadal was already assured of finishing the year as men's world number one.
The reigning French Open and US Open champion clinched that accolade for the fifth time after nearest rival Novak Djokovic lost to Federer on Thursday, eliminating the Serb from the ATP Finals and therefore meaning he could not overtake Nadal to land the prestigious prize.
As well as the two Grand Slam wins, Nadal also won ATP Masters 1000 titles in Rome and Montreal.
The 33-year-old Spaniard is the oldest player to finish as the year-end number one since the ATP rankings were introduced in 1973.
Following his victory over Tsitsipas, Nadal was presented with a trophy marking the achievement on court at the O2.
"It's a real honour to receive this trophy. Honestly, what can I say? I am super happy," Nadal said.
"After all the things I went through in my career in terms of injuries, I never thought at the age of 33-and-a-half I would have this trophy in my hands again.
"It's something really, really emotional for me, a lot of work."