London - Rafael Nadal headed home from the ATP Finals on Friday after defending champion Alexander Zverev's win against Daniil Medvedev confirmed the Spaniard's exit from the season-ending tournament.
The world No 1 recovered to beat Stefanos Tsitsipas 6-7 (4/7), 6-4, 7-5 in the early round-robin match at London's O2 Arena but knew he was dependent on the later result.
Zverev's 6-4, 7-6 (7/4) win meant he qualified for the semi-finals from Group Andre Agassi alongside Tsitsipas.
Zverev's win ruined a mouth-watering semi-final between Nadal and six-time champion Roger Federer, as the Spaniard would have topped the group had Zverev lost to Medvedev.
But instead it was Tsitsipas who topped the group and he will now play Federer in Saturday's semi-finals while Zverev will meet Dominic Thiem, who finished ahead of Federer in Group Bjorn Borg.
German seventh seed Zverev broke the fourth-seeded Medvedev early, with the Russian knowing he was already heading out of the tournament after two defeats.
But Medvedev dug deep in the second set, fending off the single break point engineered by Zverev and took it to a tie-break.
The pair swapped mini-breaks but Medvedev double-faulted to give Zverev a 5-3 lead and the German held his nerve to seal his first match point with an ace.
"I'm in the semis again, this arena is where I play my best tennis," said Zverev. "We don't play in this atmosphere anywhere else in the world.
"Today because Daniil had nothing to lose he could just enjoy it, but for me it was must-win. He's been the best player since the summer so all credit to him."
Nadal assured of No 1
Zverev, who beat Novak Djokovic in the final last year, has had a mixed season but now has the chance to end it on a high in London.
Nadal, who has already secured the year-end number one ranking, has never won the end-of-season tournament and had a miserable start at the O2 Arena, being outplayed by Zverev in his opening match.
But the 19-time Grand Slam champion produced an astonishing comeback to defeat Medvedev on Wednesday and give himself a chance of qualifying from the round-robin phase.
Tsitsipas, 21, had already qualified for the semi-finals before Friday's match after beating Medvedev and Zverev.
Serve dominated in the first set on Friday, with Tsitsipas taking it on a tie-break.
But Nadal put increasing pressure on his opponent's serve and a single break in sets two and three were enough for him to seal the match.
Following his win Nadal was in the strange position of not knowing whether he would qualify for the knockout rounds or not.
He received the trophy for finishing the year as the top-ranked player on the court at the O2.
"I'm super happy," he said. "Honestly, 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 in the shadows to be where we are today."
Federer secured a spot in the semi-finals for the 16th time in his career on Thursday by beating Djokovic in straight sets.
Results on the sixth day of the ATP Finals at London's O2 Arena on Friday (x denotes seeding):
Group Andre Agassi
Rafael Nadal (ESP x1) bt Stefanos Tsitsipas (GRE x6) 6-7 (4/7), 6-4, 7-5
Alexander Zverev (GER x7) bt Daniil Medvedev (RUS x4) 6-4, 7-6 (7/4)
Group Max Mirnyi
Juan Sebastian Cabal/Robert Farah (COL/COL x1) bt Kevin Krawietz/Andreas Mies (GER/GER x3) 7-6 (9/7), 6-2
Pierre-Hugues Herbert/Nicolas Mahut (FRA/FRA x7) but Jean-Julien Rojer/Horia Tecau (NED/ROU x6) 6-3, 7-6 (7/4)