Warren Gatland celebrated his 100th Test as a head coach with a victory and Wales go to the final round of their autumn programme and the game against Australia with successive wins behind them after a hard-fought evening spent struggling to pull away from Tonga.
The game was all but won with first-half tries from Owen Williams and Ashley Beck but, instead of accelerating away, Wales and the game hit the second-half buffers.
More importantly for a team still looking for the psychological boost of victories over any of the big three southern hemisphere sides, they will face the Wallabies with two of their main strike weapons intact, Leigh Halfpenny and George North coming through the furnace of a Tongan evening unscathed.
Halfpenny, who was nominated as one of five on the IRB shortlist for player of the year, and North, denied a second-half try by an over worked TMO, showed rare touches of class, as did Dan Lydiate, who was pushed into the starting XV when Andrew Coombs' back failed to respond to treatment.
That kept the changes from the Argentina victory a week ago to 11 but this was an under-strength Wales side, although it did not look that way with Ryan Jones all over the opening exchanges and James Hook clearly savouring his first game in the Wales No10 shirt since the 2011 World Cup. However, it took 14 minutes before they got on the board with the first of Halfpenny's kicks for goal, but then the points starting flowing. The Tonga full-back, Vunga Lilo, made a couple of attempts at losing the ball before he was finally turned over, allowing Hook to set Halfpenny away with Williams, the Blues centre, rounding things off by stepping home from 25 metres.
Tonga trundled a pedestrian responsebut once that blew itself out Hook booted Wales up field and, thanks to another Tongan fumble, Ashley Beck put North away. The wing got to within five metres but when Hook went wide again he found Beck on the wing and the Osprey centre got home in the corner.
With Halfpenny converting both tries, Wales were 17 points in the clear with 25 minutes gone but just when a long night lay ahead for the islanders, they struck back through their Wasps winger, Will Helu. The move looked innocuous enough when Sione Kalamafoni ran out of options but the Gloucester flanker saw Helu running a clever angle and Wales were left high and dry.
However, 17-7 at the interval represented a half decent return for Wales, a country which has had its troubles with island rugby in the past, although not from Tonga, but there were precious few signs of Gatland's side running away with the game in the second half, even when the head coach turned to the replacements bench.
Debutant wing Hallam Amos was denied a try by the TMO, who spotted a foot in touch and Luke Charteris looked to be home only to lose the ball over the line, but with forward dominance the order of the day, the game spent most of the second half going nowhere.
Wales: Halfpenny; North, O Williams, Beck, Amos; J Hook (Priestland 68), L Williams (R Williams 70); James (Bevington 68), Owens (Phillips 69), Rhodri Jones (Lee 69), Charteris, Evans (A W Jones 70), Lydiate, Tipuric, Ryan Jones (capt).
Tries: O Williams, Beck. Cons: Halfpenny 2. Pen: Halfpenny.
Tonga: Lilo; Vainokolo, Piutau, Paeu, Helu; Fosita, Moa (Fisilau 51); Aholelei, Taione (Taufalele 63), Puafisi (Mailau 51), Lokotui, Tuineau, Kalamafoni (Pole 46), N Latu (capt), Ma'afu.
Try: Helu. Con: Fosita.
Attendance: 46,523.
Referee: Mike Frazer (NZ).