Tonga 20-27 Wales
Wales recorded an error-strewn victory over Tonga - but the Pacific Islanders made them fight all the way in Canberra.
Steve Hansen's men had been expected to build on their impressive 41-10 win over Canada.
But in the wet conditions, they struggled to hold onto a slender lead and were guilty of poor handling and sloppy decision-making.
In a scrappy game, scrum-half Gareth Cooper and substitute Martyn Williams crossed for the men in red.
But Tonga never gave up and outscored Wales three tries to two through full-back-turned-fly-half Pierre Hola, impressive number eight Benhur Kivalu and prop Heamani Lavaka.
The result brings Tonga's hopes of knock-out qualification to an end, while Wales must now hope for victory over Italy - something that on this performance is by no means guaranteed.
The opening half was dominated by some dismal play as the rain continued to fall inside the Canberra Stadium.
Both sides scored a try apiece, with Scarlets fly-half Stephen Jones slotting three penalties and a conversion to send his side into the break with a marginal three point lead.
Cooper grabbed the game's opening try with a brilliant blind-side burst from just outside the Tongan 22.
Leading 11-3, Wales had survived an uncomfortable opening period and looked set to finally take the game to their opponents.
But it was Tonga who emerged the stronger after the interval.
Had it not been for a poor bounce of the ball, wing Sukanaivala Hufanga would have hit back immediately after some sloppy play from Cooper at the base of the scrum.
Seconds later, Rhys Williams knocked on yards from his own line, to allow the impressive Hola to recover his own kick and burst over.
The Pacific Islanders handed Wales an immediate three points direct from the kick-off after the break when Ipolito Fenukitau was caught offside.
As the pressure on Tonga increased, Mefin Davies came close after a fine midfield break and Gareth Llewelyn burst through only to hand possession over to Sione Fonua.
Three missed kicks from Jones hindered the Welsh cause and when Rhys Williams made another blistering break, he was held up over the line, much to the disappointment of the travelling Welsh fans.
As the final quarter beckoned, Martyn Williams came on from the bench to make an immediate impact, joining the small ranks of forwards to have dropped a goal in the World Cup.
But again Tonga hit back when their pack drove number eight Kivalu over the Welsh line.
The score finally shocked Wales into action with Williams adding another five points, thanks to a long floated pass from Iestyn Harris.
Tonga rightly had the last word when prop Lavaka converted some impressive pressure into points in the dying moments.
Wales: R Williams; M Jones, M Taylor, I Harris, T Shanklin; S Jones, G Cooper; I Thomas, M Davies, G Jenkins, G Llewellyn, R Sidoli, D Jones, C Charvis (capt), A Popham.
Replacements: H Bennett, A Jones, C Wyatt, M Williams, D Peel, S Williams, G Evans.
Tonga: P Hola; S Fonua, S Hufanga, J Payne, T Tu'ifua; S Tu'ipulotu, S Martens; K Pulu, V Ma'asi, H Lavaka, U Latu, V Vaki, I Fenukitau, S Afeaki, B Kivalu (capt).
Replacements: E Taukafa, T Lea'aetoa, M Ngauamo, N Naufahu, D Palu, G Leger, S Va'enuku.
Referee: Paul Honiss (New Zealand).