Federer recovered from losing the first set to reach the quarter-finals in Stuttgart.

The 36-year-old was playing his first match since losing to Thanasi Kokkinakis in the second round of the Miami Open in March, having chosen to skip the entire clay stretch for the second successive season.

Federer dropped the first set to German Zverev but recovered to win 3-6 6-4 6-2.

The Swiss needs to reach the final if he is to retake the world number one spot from Rafael Nadal, who announced his withdrawal from the tournament at Queen’s Club on Wednesday.

A run to the final plus the successful defence of his title in Halle next week would see Federer ranked number one for the defence of his Wimbledon title next month.

Elsewhere on Wednesday, Indian qualifier Prajnesh Gunneswaran upset sixth seed Denis Shapovalov 7-6 (8/6) 2-6 6-3 in their first-round match and could yet play Federer should he go on to progress against Guido Pella.

Seventh seed Milos Raonic came through his first-round match against Mirza Basic 7-6 (10/8) 6-2, while eighth seeded Spaniard Feliciano Lopez progressed after Viktor Troicki was forced to retire having lost the first set 6-1.

At the Libema Open in s-Hertogenbosch, third seed Gilles Muller crashed out as the Frenchman lost 6-3 7-5 to Australia’s Matthew Ebden.

Sixth seed Robin Haase also failed to make an impact as he lost 6-3 7-5 to wildcard Bernard Tomic and Japan’s seventh seed Yuichi Sugita went out 7-5 4-6 6-4 to Marius Copil of Romania.