Flyhalf Kurth Morath slotted four penalties and converted Sukanaivalu Hufanga's try for Tonga, who had needed a four-try victory to give them any chance of qualifying for the quarter-finals.
Winger Vincent Clerc scored an injury-time try to rescue a bonus point, for losing by fewer than eight points, as scrumhalf Dimitri Yachvili slotted three penalties for a dismal France side who were outplayed in the second half.
New Zealand top Pool A on 15 points with one match to play, while France will finish second on 11 points after completing their four fixtures and face the winners of Pool B in the quarter-finals. Tonga ended their campaign on 9 points.
"Towards the end, probably the last eight minutes, we knew we couldn't score three tries and I thought it was important for us to win the game first," Tonga coach Isitolo Maka told reporters of his team's strategy of not trying to get a bonus point.
"That's why we decided to kick goals and not go for tries. The thing for us was to make sure we won the game."
France had the better of the opening exchanges, though their scoring was restricted to a Yachvili penalty, which was quickly negated when Morath slotted the first of his four successful kicks.
The score ignited the Pacific islanders, who began to find gaps in the French defensive line, particularly running directly at centres Maxime Mermoz and Aurelien Rougerie, who appeared to be hampered by a leg injury sustained earlier in the game.
Yachvili managed to give the French a 6-3 lead in the 23rd minute with his second penalty before Tonga stormed ahead after Hufanga gathered Morath's cross-kick and shrugged off Julien Bonnaire's tackle for the game's first try.
Morath converted the score then added a 36th minute penalty for Tonga, who had Hufanga sinbinned by referee Steve Walsh for a dangerous tackle on Clerc.
Tonga held the French out to reach halftime with a 13-6 lead that they could have extended less than three minutes into the second period though Morath missed the penalty.
Yachvili reduced the deficit to 13-9 with his third penalty of the match, although the French never really threatened again until the last two minutes.
The match was effectively over as a contest when France replacement Fabrice Estebanez was sinbinned for a dangerous tackle on Joe Tu'ineau and Morath added his third penalty.
Morath added a fourth penalty after Tonga had squandered a golden opportunity to score a late try and Clerc rounded off the scoring with an unconverted try in the corner after a series of scrum penalties.
"We are not happy for this qualification, but we have qualified," France coach Marc Lieveremont told reporters through a translator.
"We are alive and part of this adventure and have to fight and so do the players who are disappointed with the performance."