The Tongans� victory, in a tight and tense match played in difficult, wet conditions at Headingley, means runners-up Fiji also go through to the main draw.
Samoa, frontrunners after beating Fiji and Cook Islands in earlier group matches, lose out on automatic qualification because of an inferior points difference but could win a reprieve in the repechage.
The qualifiers will join Australia, New Zealand, England, France and Papua New Guinea in the 10-team tournament, to be held in Australia in two years� time.
The Samoans would have gone through had they lost by six points and the outcome rested on a missed goalkick from full-back Tangi Ropati, arguably their best player.
Man of the match was Harlequins RL forward Solomon Haumono, who led the Tongans from the front, scoring the all-important try on the stroke of half-time that broke the deadlock.
Tonga substitute Taniela Tuiaki had opened the scoring in the 22nd minute but Conrad Ta�akimoeaka pulled Samoa level four minutes before half-time after Castleford Tigers second rower Gray Viane had made the crucial break.
Winger Malo Somomona, cousin of New Zealand Test forward David, added a second try for Samoa early in the second half but the match was settled when substitute Makasini Richter went over on the hour and scrum-half Joel Taufa�ao kicked his third goal from as many attempts.