By Matt Lloyd (in Canberra)
Wales stuttered their way to showdown against Italy for a quarter-final place with an unconvincing 27-20 victory over pool rivals Tonga.
A moment of opportunism from Gareth Cooper and a brief glimpse of Iestyn Harris magic to create Martyn Williams' try were the only highlights in an otherwise uninspired performance.
Tonga outscored Wales three tries to two but crucially Pierre Hola missed four kicks at goal as Wales clung on against the South Sea island minnows for their second win of the World Cup.
"It was only a five or six out of ten performance but the fact is that we got the win so we have to be pleased with that," said Wales coach Steve Hansen.
"We weren't complacent although it is always difficult after a victory by 40 points and with a big game like Italy coming up, people's minds tend to drift.
"We didn't play extremely well but we got the four points which is what we came for though we have plenty to work on before the game against Italy.
"We made mistakes and put ourselves under pressure which is something we are going to have to look at."
Stephen Jones got Wales on their way with a penalty within just four minutes and put Wales ahead again with a second some eight minutes later after Hola had levelled the scores.
And when Cooper scampered over from the tail of the scrum some 15 yards out, Wales looked to be on their way.
But a mistake in defence by full-back Rhys Williams, who failed to collect Hola's kick ahead in the wet conditions mistake, allowed the Tongan outside-half to pick up and score to bring the scores back to within a point
just four minutes later.
Neither side were able to take a grip on the game in the wet conditions though two more Jones penalties either side of half-time put Wales 17-10 ahead.
Nevertheless Wales struggled and after Jones missed three attempts at goal, it was left to flanker Martyn Williams to slot over a drop goal just three minutes after taking the field as a replacement.
However Wales could not shake off Tonga who hit back with a try from captain Benhur Kivalu and even after Williams had latched onto Harris' try for Wales second, the south sea islanders pulled one back again through prop Heamani
That set up a tense last two minutes for Wales and had Sukanaivalu Hufanga caught Hola's pass he looked destined to score a try that would have levelled the scores.
However Wales held out and now face Italy for the game that is likely to decide who join the All Blacks in the last eight.
Wales: R Williams; M Jones, M Taylor, I Harris, T Shanklin; S Jones, G Cooper (D Peel, 54), I Thomas (A Jones, 63), M Davies (H Bennett, 71), G Jenkins, G Llewellyn (C Wyatt, 57), R Sidoli, D Jones, A Popham (M Williams, 59), C Charvis (capt)
Tries - G Cooper, M Williams. Con - S Jones. Pens - S Jones (4). Drop Goal -
Tonga: S Va'enuku; S Fonua, S Hufanga, J Payne, T Tu'ifua; P Hola, S Martens; K Pulu, V Ma'asi (E Taukafa, 70), H Lavaka, U Latu, V Vaki, I Fenukitau (T Lea'aetoa, 72), B Kivalu (capt), S Afeaki (M Ngauamo, 63)
Tries - P Hola, B Kivalu, H Lavaka. Con - P Hola. Pen - P Hola.
Referee: P Honiss (NZ) Attendance: 19,806.