Impressive defence from the Canadians held out against the impatience of the Tongans, who wasted their opportunities and now face a huge challenge to qualify for the finals.
Canada opened a ten point lead in the first half courtesy of a Jebb Sinclair try in the 14th minute and a penalty converted by James Pritchard.
Tonga wasted their early chances, often forcing passes in the face of a solid shifting defence from the Canadians.
However, they went into the break just three points behind, Siale Piutau scoring a try right on half-time. Kurt Morath converted, having earlier missed two penalties into a strong breeze at Whangarei.
Canada opened the second-half scoring with a penalty conversion, but Tonga pushed in front in the second half, with Piutau scoring another try for Tonga to take the lead for the first time, up 17-13 with the conversion.
A converted penalty saw the Tongans out by seven points after 65 minutes.
Canada rallied with two late tries despite numerous penalties flowing against them, with the first unconverted to leave them trailing by two.
The decisive winner was scored by Canadian winger Phil Mackenzie who took the game beyond the Tongans.
CANADA 25 (Aaron Carpenter, Phil MacKenzie, Jebb Sinclair tries James Pritchard 2 cons 2 pens) bt TONGA 20 (Siale Piutau 2 tries Kurt Morath 2 cons 2 pens) at Northland Rugby Stadium. Referee: Jonathan Kaplan.