Zverev, 21, is the youngest player to reach the final of the season-ending event since 2009 and the first from Germany since 1996.
Federer, 37, was seeking a record-extending seventh title, but was unable to cope with the pressure created by Zverev's power and precision at the O2 Arena.
An inspired series of shots earned Zverev the first break points of the match in the 12th game and Federer sent a forehand wide to fall behind.
Federer broke for a 2-1 lead in the second set, but Zverev quickly composed himself to hit straight back in the following game.
The second set eventually went to a tiebreak which was shrouded in controversy.
Serving at 3-4 in the second-set tiebreak and with Federer in a strong position in the rally, Zverev stopped play when he spotted a ball boy behind Federer had dropped the ball and had moved forward to pick it up.
The umpire duly called a let and when the point was replayed, Zverev won it. After sealing victory, Zverev said he had said sorry to Federer at the net.
"I want to apologize for the situation in the tiebreak," Zverev said. "The ball boy dropped the ball. It is in the rules that we replay the point."
Sections of the crowd inside London's O2 then began to boo Zverev but the on-court interviewer, former British player Annabel Croft, sprung to Zverev's defense. "I'm not sure why you're all booing," she said. "I think you have to be a little bit more respectful."