Roger Federer came out on top in a gripping battle with Jo-Wilfried Tsonga to reach the quarter-finals of the Halle Open on Thursday.

Top seed Federer, a nine-time winner of the grass-court tournament in Germany, was made to work for a 7-6 (7-5) 4-6 7-5 victory.

Tsonga had won his previous two matches with Federer - his most recent success coming in Monte Carlo three years ago - and threatened a repeat before suffering a second-round loss.

Frenchman Tsonga, a wildcard entry into the event, and Federer both played with aggression but it was the 20-time grand slam champion who had the edge.

Tsonga fought back from 3-1 down in the second set to go the distance, but Federer claimed the only break of the decider to ensure he will face Roberto Bautista Agut in what will be his 17th quarter-final in as many appearances in Halle.

Alexander Zverev progressed with a 6-3 7-5 defeat of Steve Johnson and will now come up against David Goffin.

Second seed Zverev withdrew from the doubles due to a swollen knee, but struck 27 winners to reach his fifth quarter-final of the season.

The in-form Matteo Berrettini won an all-Italian encounter with Andreas Seppi, while Bautista Agut accounted for Richard Gasquet 6-1 6-4.