Warren Gatland's Wales have taken another step towards the Rugby World Cup quarter-finals, but they were given a fierce examination by minnows Portugal before winning 28-8 at Stade de Nice.
The coach's much-changed team struggled throughout for control and fluency in the pool C contest, the highlight of which was Portugal's attacking flair.
Wales started Saturday's (Sunday AEST) contest with only three survivors from the side that defeated Fiji last weekend, and their latest performance was a world away from what they delivered in Bordeaux.
Wing Louis Rees-Zammit, captain Dewi Lake, flanker Jac Morgan and No.8 Taulupe Faletau scored tries, while Leigh Halfpenny kicked three conversions and Sam Costelow landed one, yet a vast improvement will be required for the big one against Australia in Lyon next weekend.
"It wasn't pretty but we got the job done," said New Zealander Gatland. "A few of the boys looked a bit rusty having not played together, but we'll take the win and move on.
"In fairness to Portugal, they put us under pressure. They moved the ball well and I was impressed with them."
Wales top pool C on 10 points. Australia (five) and Fiji (two) meet on Sunday (Monday AEST) with Wales then facing Australia next weekend.
"If someone said you would have 10 points from the first two games, we would have been pretty happy with that," Gatland said.
"It's good we have given everyone in the squad an opportunity and some rugby. We have a little bit more time in terms of preparation before Australia and we can start looking forward to that game."
Portugal gave as good as they got for large parts of the game, and undoubtedly deserved more than flanker Nicolas Martins' try and a Samuel Marques penalty, with Wales not collecting a bonus point until the dying seconds.
Portugal's exciting back division stretched Wales' defence in all directions, although wing Vincent Pinto blotted his copybook when he was red-carded late in the game following a bunker review after his boot caught Josh Adams in the face.
Wales suffered an injury blow shortly before kick-off when flanker Tommy Reffell withdrew from the starting line-up and was replaced by Morgan.
Portugal, playing their first World Cup game for 16 years, were captained by centre Tomas Appleton and under the coaching direction of former France international wing Patrice Lagisquet.
Marques missed a golden chance to put his team in front when he sent a short-range penalty wide, and Wales went ahead through a ninth-minute try that saw an impressive finish from Rees-Zammit.
Wales erred in sight of Portugal's line, and their frustration was underlined when Johnny Williams received a yellow card following a technical infringement.
Portugal were outstanding but Wales just could not get going.
Wales claimed a third try after 56 minutes when Morgan crossed from close range and Halfpenny added the extras.
Portugal deservedly claimed a try midway through the second half when clever lineout work produced a try for Martins.
The closing stages were all about whether or not Wales could secure a bonus point, and Faletau scored in the game's final play.