Roger Federer held young pretender Alexander Zverev at bay in a gripping contest on Tuesday to reach the last four of the ATP Finals and stay on course for a seventh end-of-season crown.

The world number two saw off a spirited challenge from the much-hyped German 7-6 (8/6), 5-7, 6-1 in front of a boisterous pro-Federer crowd to become the first man through to the last four at the O2 Arena.

“It was a good battle and I always enjoy myself at this beautiful arena,” said Federer, who has now reached the semi-finals 14 times.

“I have so much fun playing in London and I have been so successful here. Thank you for making it such a special night.

“I’m happy and relieved that I can play freely against (Marin) Cilic, instead of it being a nailbiter. It’s been a tough group so to be through in two matches is great.”

Both players were scratchy on serve at the start of the match but were quickly into the groove in a tight first set that saw no breaks of serve, though Zverev had to fend off two set points in the 12th game to force a tie-break.

The 20-year-old third seed raced into a 4-0 advantage only to see the Swiss charge back to lead 5-4. Zverev earned a set point of his own at 6-5 but could not convert and Federer made his third set point count.

The 19-time Grand Slam champion broke in the first game of the second set to establish an iron grip on the round-robin match but Zverev hit back in the fourth to get back on level terms.

Federer only landed 43% of first serves in the second set and it finally cost him in the 12th game, when Zverev capitalised on his third set point to force a decider.

The Swiss re-found his focus and some consistency on serve in the decider as Zverev’s level dipped, earning three breaks to close it out 6-1.

Zverev has been touted as the leader of a pack of young players hungry to oust the creaking old guard but Federer, who has suffered only four defeats all year, shows no sign of slipping.

Coming into the match Federer, 36, and Zverev had faced each other four times and each had won twice.

This year, Federer beat the German in Halle but Zverev returned the favour at the Rogers Cup in Montreal.

Sock wins

Earlier, also in the Boris Becker group, Jack Sock kept his dreams of a fairytale finish to his season alive, beating Wimbledon finalist Marin Cilic 5-7, 6-2, 7-6 (7/4).

“It’s been an interesting morning so far,” said the American. “The fire alarm went off at 4:00 am and we had to exit the building. But I love playing here in London. It’s an amazing atmosphere, you make me feel like home.”

The top two players from each of the two groups of four progress to the semi-finals.

Federer, who beat Sock in his first match, is the standout star at the tournament after the withdrawal through injury of world number one Rafael Nadal.

Novak Djokovic, Andy Murray and Stan Wawrinka are all long-term absentees from the Tour this season