Six-time champion Roger Federer was “happy and relieved” to see off the challenge of 20-year-old Alexander Zverev and reach the last four at the season-ending ATP Finals in London.
Federer, 36, proved the stronger in the final set, winning 7-6 (8-6) 5-7 6-1.
Germany’s Zverev, seeded third, can still qualify for the semi-finals on his debut appearance at the O2 Arena.
He will play American Jack Sock in his final group match on Thursday, with the winner to progress to the last four.
Eighth seed Sock earlier beat Croat fifth seed Marin Cilic 5-7 6-2 7-6 (7-4) in the second round of matches in the Boris Becker Group.
“That was a tough one for sure,” said Sock.
“It’s been an interesting morning so far, the fire alarm went off at 4am and we had to exit the building. But I love playing here in London, it’s an amazing atmosphere, you make me feel like [I’m] home.
“I’m just excited to win and keep myself alive.”
5 best shots as Sock beats Cilic
In the Pete Sampras Group on Wednesday, Grigor Dimitrov will play David Goffin at 14:00 GMT followed by Dominic Thiem against Pablo Carreno Busta, who replaces the injured Rafael Nadal, at 20:00.
Jamie Murray and Brazil’s Bruno Soares take on Marcel Granollers and Ivan Dodig in their second doubles group match at 18:00.
Federer made it through to the semi-finals for a remarkable 14th time at the season finale, but was pushed hard for two sets by the leading light of the new generation.
Zverev showed his class with some brilliant serving in the first set, making 76% of his first serves, but it was still not enough.
The German had three chances to break in the opening game and would later lead 4-0 in the tie-break, before a rash of forehand errors allowed Federer to come back and take it.
An early break of serve in the second set looked to have the Swiss in complete control, but from 2-0, 30-0, he surprisingly hit successive double-faults and lost his way for the next few games.
Clearly rattled by his wavering form and increasingly confident rival, Federer eventually cracked in the 12th game to send a forehand wide and give up the set.
The adrenaline was coursing through Zverev but the effects had worn off three games later, when a tired double fault opened the door for Federer to get the key break, celebrating with a loud “Come on!”
Four errors in succession saw Zverev hand over the double break and it became three in a row when the German double-faulted on match point after two hours and 13 minutes.
Federer can now look forward to a final group game against Cilic knowing there is only pride, and the wish to maintain his winning run, on the line ahead of Saturday’s semi-finals.
“I’m excited for Alex’s future. He’s a wonderful guy and a great, great player,” said Federer.
“I’m happy and relieved that I can play freely against Cilic, instead of it being a nail-biter. It’s been a tough group so to be through in two matches is great.”
Zverev is one of only four men to have beaten Federer this year, and his self-belief was evident from the off. He put his 6ft 6in frame to magnificent use with some fine serving in the first two sets, and his backhand really rattled Federer, who could be heard muttering to himself on more than one occasion.
But Federer still came out on top, and ultimately at a canter.
He remains the strong favourite to win this title for a seventh time, although he might just have to beat Zverev again in Sunday’s final.