The Swiss great converted four of his 10 break points to end a two-match losing streak and start his grass-court season with a win.
“Three months is a long time, it’s longer than the year-end break. So I’m very happy returning on good terms,” said Federer, who skipped the entire clay-court season for the second year in a row.
Zverev had never won a set against Federer in their five previous meetings, but he took the first before the second-ranked Swiss upped his game and broke the German twice to force the decider.
Indian qualifier Gunneswaran upset sixth-seeded Denis Shapovalov of Canada 7-6 (6), 2-6, 6-3 in their first-round match.