London - Rafael Nadal was unable to crown his season with a first ATP Finals title but he ends it as world No 1 and with a chance to lead Spain to Davis Cup glory.
The Spaniard, who came to London under an injury cloud, had a terrible start to his week at the O2 Arena, crushed in straight sets by defending champion Alexander Zverev in his first round-robin match.
But he produced a performance of astonishing grit to recover from 5-1 and match point down against Daniil Medvedev and saw off Stefanos Tsitsipas in three sets on Friday.
It was not quite enough to reach the semi-finals but Nadal leaves London after securing the year-end No 1 ranking for a fifth time, pulling level with Roger Federer and Novak Djokovic.
Nadal was in the strange position after his win against 21-year-old Tsitsipas of not knowing whether he would be heading home or playing Federer in the knockouts.
Later, Zverev's win against Medvedev confirmed his tournament was over.
The 33-year-old, who was presented with the trophy for securing the No 1 spot on court, said it was difficult to compare the achievement with winning a Grand Slam.
Nadal is now on 19 majors, just one behind Federer after winning his 12th French Open this year and his fourth US Open crown.
"I know it is something so important because to achieve this you have to play well for 11 months," he said.
"To win a Grand Slam you have to play well two weeks. But it's difficult to compare. For me personally, when you win a Grand Slam, you win a Grand Slam winning the last point, and that feeling you, can't have it here. That's the big difference."
But he said finishing on top of the world was a great achievement after his struggles with injuries earlier in the season.
And he was delighted to pull level on five year-end finishes with Djokovic and Federer - the other two members of the "Big Three".
Nadal can look back on another staggering year in which he has shown remarkable consistency, winning four trophies including two Masters titles.
He reached the semi-finals at all four Grand Slams in a season for just the second time in his illustrious career.
But it did not start too promisingly for the veteran, who was plagued by injuries early in the season, including a thigh strain and right knee injury.
The injury jinx struck again late on, forcing him to miss October's Shanghai Masters with a wrist injury and his participation at the ATP Finals was in doubt after he withdrew from the Paris Masters at the semi-final stage with an abdominal strain.
But now the dust has settled, Nadal can look back on another staggering season in which he overtook Djokovic in the final stretch to top the rankings.
"My decision or our decision is to try to do the things to play as long as possible, so that's why I tried to do the conservative calendar in terms of saving the body and everything," said Nadal.
"But the thing is when I have been playing, I have been playing very well. I achieved almost every single time the last rounds of every tournament.
"So that's why I'm put in a position that I am where I am today, having this trophy with me."
And it is not over yet for the Spaniard.
Nadal has the chance to lead Spain to glory in the new-look Davis Cup in Madrid next week and he is raring to go.
Changes to the tournament's format mean 18 teams will be vying for the title over the course of a week.
"Let's see how the thing works," he said. "I am sure that they did great and it is going to be something really special. And playing at home even more.
"So excited about it. I really hope that the team is working the right way during these previous days of the tournament, so I really expect to find a team very well-prepared when I arrive there."