Wales 27 Tonga 20
Wales were forced to battle hard for their second World Cup victory, but secured it with a late cameo from replacement flanker Martyn Williams and some desperate defence.
The former British Lion landed a rare drop goal and then scored only his second Test try to finally seal the victory against a Tongan outfit whose threat was undermined by a hefty penalty count.
Gareth Cooper had given Wales the ideal start with an opportunist's try down the blindside while fly-half Stephen Jones finished with a personal haul of 14 points. But his kicking was wayward at the beginning of the second half and it could have proven costly.
Tonga ran in three tries in all, through Pierre Hola, captain Benhur Kivalu and then prop Heamani Lavaka just minutes from the end.
Hola, though, missed four of his six goal attempts and Wales survived a late onslaught to remain unbeaten and on course for a possible quarter-final showdown with England.
But to have any chance of beating their long-time rivals, Steve Hansen's side first have to see off Italy and for that they will need to improve immeasurably.
Their execution was poor, their defence often ragged as the Tongans burst through the middle and threatened out wide. But for unfortunate bounces, the Tongans could easily have had two more tries, though Rhys Williams did cross for Wales only for television replays to show he was held up over the line.
Iestyn Harris, in striking form last week, struggled to make as much of an impact against Tonga after being included as a late replacement for centre Sonny Parker.
The Tongans were determined to come out with all guns blazing after coach Jim Love gave them a dressing down for lacking the necessary fire in their opening defeat to Italy.
But in sheeting rain at the Canberra Stadium, opening encounters were more frustrating than bone-crunching as Tonga were penalised time and again for infringements at the breakdown.
It allowed Stephen Jones, starting his first game of the World Cup, the chance to open his account with two simple penalties, the second of which ended a move set up by Tom Shanklin's fine run through the middle.
Rhys Williams then sent Mark Jones away down the left, and although he was halted just short of the line, Wales earned a series of scrums inside the Tongan 22 and slowly tightened the screw.
Cooper finally made it pay when he scampered over untouched from the base of a Welsh scrum. With handling becoming increasingly tricky, Williams was soon caught out as he failed to deal with a stab through from Hola and the fly-half followed in to touch down under the posts.
Hola then converted but sailed a 38-metre penalty just wide as Wales retained the lead through to the interval.
Tonga had conceded nearly twice as many penalties as Wales and in the opening seven minutes of the second half, Stephen Jones was presented with another three opportunities. But he missed twice, failing to nail home advantages earned by increasing Welsh pressure.
After a third miss on the spin, Stephen Jones did succeed in releasing the pressure with a pinpoint kick down field and only a desperate tackle from Sione Fonua denied Rhys Williams his try.
Then in stepped Martyn Williams who put himself right in the middle of the action and turned the game in Wales' favour.
PA