The Swiss great was in control after taking his third set point in the opener and starting the second set with a break. But Tsonga, who won their only previous meeting on grass at Wimbledon in 2011, managed to break twice to force the decider.
Both players stayed on serve until Federer broke for a 6-5 lead and won the match with his seventh ace.
Federer, who lost last year's final to Borna Coric, next faces Roberto Bautista Agut in the quarterfinals of the Wimbledon warmup tournament. The Spaniard defeated Richard Gasquet 6-1, 6-4.
Federer already has the best grass-court record in the Open era with 18 titles, and the 37-year-old can set a personal record with his 10th at a single event in Halle.
Also Thursday, home favorite Alexander Zverev defeated American Steve Johnson 6-3, 7-5, and Stuttgart Open champion Matteo Berrettini beat Italian compatriot Andreas Seppi 4-6, 6-3, 6-2.
More AP Tennis: https://www.apnews.com/apf-Tennis and https://twitter.com/AP_Sports
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.