With Jack Sock having beaten Marin Cilic earlier in the day, the Australian Open and Wimbledon champion knew he would clinch a place in the last four with victory,
Zverev has charged sharply up the rankings and now sits at third in the world, and the 20-year-old's contest with the 19-time grand slam winner was billed as a battle between the master and the apprentice.
It was the master who prevailed on this occasion, but only after he had received a significant examination from the German in what was the fifth match out of six at the season-ending showpiece to go the distance, with Federer eventually prevailing 7-6 (8-6) 5-7 6-1.
Zverev now must win his final clash in Group Boris Becker with Sock to seal his spot in the last four.
If an illustration of the challenge Zverev presents was needed, it was provided when Federer was forced to save three break points in the opening game, the Swiss then seeing one go begging in the subsequent game.
The fact that an exasperated Federer shouted, 'Come on!' as early as the fifth game after winning a point to go 40-30 ahead was a further compliment to Zverev, who summoned his resolve to withstand a late barrage, saving two set points in his last service game to force a tie-break.
He then raced into a 4-0 lead in the breaker, only for Federer to rattle off eight of the next 10 points - saving a set point in the process - to forge ahead.
Federer hit 17 winners to his opponent's 10 in the first set and it looked as if he would canter to a routine victory when he broke in the first game of the second courtesy of a lifeless Zverev drop shot before holding to love.
But again Zverev's admirable resilience came to the fore, a poor Federer volley giving him enough room to nail a forehand down the line and get the set back on serve.
Some strong serving and a deft backhand volley stopped Zverev from claiming the double break at 4-3 up, but Federer's backhand escaped him in the final game of the set.
Zverev surged into a 40-0 lead and, after seeing two break points squandered, clinched the third when Federer sent a cross-court shot wide at the end of a superb rally.
However, an errant cross-court backhand from the 20-year-old gave Federer the initiative and a 2-1 lead in the third, and this time there was no way back.
The double break came in short order as Zverev's forehand fell apart in the fifth game and, though Federer's serve came under some pressure in the next, he made no mistake in progressing to the semis for the 14th time in 15 tournament appearances.