Monfils went toe-to-toe with the 17-time Grand Slam champion during a feast of attacking tennis, eventually emerging on top 6-4, 6-7 (5/7), 6-3.
Federer, playing his first tournament since the US Open, started in the worst possible way, limply losing his first service game to immediately hand the initiative to Monfils, who went on to take the opener.
Despite vocal support from a partisan crowd, Federer was broken midway through the second set but he broke back, sealing the game with an overhead smash.
With both players sticking to a plan of all-out attack, Monfils grabbed the initiative, breaking to take a 3-1 lead and managed to save the break points that Federer carved out before going on to seal the match.
More From This Section
Federer, who made early exits at Wimbledon and the US Open, came to Shanghai seeking much-needed points as he bids to reach next month's World Tour Finals, which he has won a record six times.
The powerful Tsonga had a battle on his hands early on against the Japanese 12th seed but came out on top in a first-set tie-break and romped through the second set without losing a single game to record a comfortable 7-6 (7/5), 6-0 victory.