Wales clung to an eight-point lead with seven minutes left until a strong carry by Leigh Halfpenny scattered the Uruguayan defence and opened up a hole for Tomos Williams to settle the matter with the bonus-point try.
Wales also scored tries from Nicky Smith, Josh Adams, Gareth Davies and a penalty try but coach Warren Gatland was a picture of discontent for much of the evening.
His team were denied four tries, including two from forward passes, and committed a slew of handling errors on a perfect night for rugby.
"We know we have to do a lot better than that. But we have to be happy that we came away with a bonus-point win," said flanker Justin Tipuric, who led the side for the first time in place of regular rested skipper Alun Wyn Jones.
"You have to give Uruguay credit. They didn't stop from the beginning to the end and they're a tough bunch of boys."
Uruguay bowed out of the World Cup with huge satisfaction having earned plenty of respect from tier-one nations and also upset Pacific power Fiji earlier in the tournament.
"There were areas where we were able to play how we wanted and we were also able to shock Wales," said coach Esteban Meneses.
"We were able to show how we have developed Uruguayan rugby."
The Welsh had come into match with 13 changes and a patched-up backline with Dan Biggar sidelined after his second head knock of the tournament.
A moment of silence was held before the game for victims of Typhoon Hagibis, which pounded into Japan's main island of Honshu on Saturday.
Wales dominated possession in the early exchanges but their raids were stopped by some dogged Uruguayan tackling.
Flanker Aaron Shingler broke through on the right wing to plant the ball by the flag in the 11th minute but the try was disallowed as he was well outside the touch line.
With their try-line under siege, Uruguay's resistance broke in the 17th minute as prop Nicky Smith was driven over.
Wales were denied a second try in the 25th minute, with Hadleigh Parkes putting winger Hallam Amos over with a forward pass.
Not even a chorus of singing from Welsh fans could help Gatland's side as they turned over the ball deep in Uruguay's 22 and gave Berchesi a second penalty in front of the posts.
It was all back-slapping and smiles among the Uruguayans as they jogged off with only a 7-6 deficit at halftime.
Wales re-booted after the break, testing Uruguay with the high ball.
Bradley Davies was bundled back over the line near the posts by the desperate Uruguayans but the big lock's strong carry created an overlap out wide and an unmarked Adams cantered over at the left corner after a long pass from Rhys Patchell.
Wales were threatening to break the game open, but the scrappy play returned as Parkes' horror night continued.
The inside centre blew a third try for Wales by putting Amos over the line with another forward pass.
A yellow card to Uruguay flanker Santiago Civetta eased the pressure and paved the way for a penalty try as Wales rumbled a maul toward the line.
Yet Uruguay rallied brilliantly, with hooker German Kessler diving over from in close to give the Welsh a scare in the 71st minute.
Wales rose to the challenge as Williams grabbed the bonus-point try but were left red-faced minutes later when winger Amos spurned another try when he failed to plant the ball correctly when doing a flamboyant swan dive.
In a madcap finish, Davies ensured Wales finished on a high note as he burned away from the Uruguayan defenders after a turnover to cross under the posts.
48,780 people have also been wounded in the war, a spokesman said
Pentagon says 14,000 tank shells will be sold to Israel without Congressional review