Having not dropped a set in his four lead-in matches, the Swiss maestro was pushed hard by the flamboyant Frenchman, who stormed back into the match twice with some brilliant shot-making under the lights of Rod Laver Arena.
The 31-year-old Swiss was, however, a model of composure as he broke the Frenchman early in the decider and prevailed 7-6 4-6 7-6 3-6 6-3 to set up a mouth-watering semi-final with Briton Andy Murray.
"It was a tough close for sure, but the whole match was tough. Any set could have gone any way," the 31-year-old said in a courtside interview.
"I feel a bit lucky obviously to come through...but it was a great pleasure to play Jo because he played great too.
"We haven't played for a year...but I thought he played extremely aggressive."
Battling for survival, Tsonga saved four match points when serving to stay in the match, but Federer closed out victory on the fifth in the following game with an overhead smash to keep alive his bid for a fifth title in Melbourne.
A disappointed Tsonga, losing finalist to Novak Djokovic in 2008, provided a flicker of hope for the nearly-men behind the 'Big Four' of men's tennis, and vowed to come back stronger.
"I'm a bit in the bad mood because I lost it. But in another way I played a good match. I was solid, I was there every time.
"I just gave my best today, so I'm proud of that, but I'm not happy to lose, and I already look forward to the next tournament, the next grand slam, to try another time."
Federer's ability to coax his 31-year-old legs through a five-set epic has been questioned here, and the Swiss appeared determined to wrap up the match quickly, breaking Tsonga in his opening service game.
The athletic Frenchman composed himself, however, breaking back to take the set into a tiebreak.
Tsonga dropped his guard, allowing Federer a 3-0 head start, and yelped in dismay after slamming a backhand into the net to concede the first set.
The Frenchman raised his game in the second, allowing the Swiss only two points on his serve before sealing it with a huge serve that grazed the T-line.
The momentum swung again in the third as Federer lifted the pressure, leaving his opponent shaking his head with a series of stunning retrievals.
Having come close to being rattled, Federer roared in triumph as he landed a searing backhand down the line to bring up two set points.
Federer closed it out in spectacular fashion, charging to his left to retrieve a stinging cross-court backhand, then angling an improbable return at Tsonga's shoelaces that the Frenchmen could only poke wide.
That was the prelude for a stunning fourth set as both surrendered their serve in the face of sumptuous shot-making.
With adrenalin pumping, Tsonga fired a scorching passing shot to bring up break point in the eighth game, then finessed a backhand volley into the corner to serve for the set.
Federer blasted a backhand wide to allow the Frenchman set point, and Tsonga pumped his fists after sealing it with an ace.
Tsonga was left to rue a lapse in the third game of the decider, as he sprayed three unforced errors to gift Federer the break.
It was a setback he would ultimately prove unable to recover from.
Federer said he looked forward to another match-up with Murray, whom he beat in their last encounter at the semi-finals of the ATP Tour Finals. "I had some tougher runs against him in a short period of time," he told reporters.
"But I always enjoyed the matchups with him because it gets to be very tactical."
(For more sports news and updates, follow Ahram Online Sports on Twitter at @AO Sports and on Facebook at AhramOnlineSports)