Representing his country in the mixed team event in Perth, Federer beat Briton Dan Evans on Monday but he faced stiff opposition from Zverev who enhanced his reputation by claiming his second win in three matches over the player many consider the greatest.
Federer served for the first set at 5-3 but the 19-year-old Zverev fought back and eventually rolled through the tie-breaker to claim the first set.
Federer, 35, took the second set in similar manner to force the decider but Zverev had the last laugh in the pulsating contest.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
"To beat Roger, you really have to play an unbelievable match, from the first point to the last. I thought we both played really well," Zverev said in a courtside interview after putting Germany 1-0 up in the Group A tie.
"I always play unbelievably against him. It's always nerve-racking to play against him. I always play in front of a big crowd which helps me a lot as well," added Zverev, who also beat Federer in the Halle Open semi-finals last June.
(Reporting by Amlan Chakraborty in New Delhi; Editing by Clare Fallon)
