Edinburgh - A 64th minute try by centre Jonathan Davies has helped Wales overcome the challenge of a spirited Scotland side 26-23 to get a 2015 Six Nations win on the board at the second attempt.
The Clermont Auvergne midfielder burst through the home defence to score under the posts and effectively settle a tight Celtic contest in favour of the Welsh, who lost their opening night home fixture against England 21-16.
The victory maintained Warren Gatland's record of never having lost to Scotland in eight seasons as Wales' head coach. For his opposite number, fellow New Zealander Vern Cotter, a last minute try by replacement lock Jim Hamilton came too late to avoid a second successive defeat in the championship, following Scotland's 15-8 defeat against France in Paris.
Both teams failed to trouble the scoreboard in the second halves of their opening weekend matches but Wales were 3-0 up in the seventh minute, full-back Leigh Halfpenny nailing a penalty after Scotland's openside flanker Blair Cowan was caught on the wrong side of a ruck.
Not that the visitors were able to press home their advantage. Indeed, they found themselves 7-3 behind in the 10th minute after being hit by a fine Scottish counter-attack.
Scotland outside-half Finn Russell stripped the ball from Alex Cuthbert and fed it on via lock Richie Gray to Stuart Hogg, who hared 60 metres up the left to score -- a sweet moment for the Glasgow full-back, his sending off in Cardiff last year having precipitated Scotland's 51-3 record defeat against Wales
Greig Laidlaw, Scotland's scrum-half and captain, added the conversion and then stretched the lead to 10-3 with an 18th minute penalty. His side had to absorb some sustained pressure after Halfpenny took a high ball and set Rhys Webb away on a left wing charge.
Hogg managed to stop the Welsh scrum-half but Scotland conceded a penalty that Halfpenny converted to make it 10-6 with 21 minutes on the clock.
Eleven minutes later the Scottish lead was cut to 10-9, Halfpenny landing a third penalty after Russell was judged to have impeded Dan Biggar when the Welsh outside half was attempting to gather a Garryowen.
It was difficult to say whether Russell was attempting to get out of the way in turning his shoulder but Kiwi referee Glen Jackson - Cotter's star fly-half in his time as Bay of Plenty coach - showed a yellow card to the Glasgow playmaker.
The numerical advantage soon told, winger Liam Williams sprinting up the left before feeding an inside pass for Webb to score in the 34th minute. Halfpenny's conversion put Wales 16-10 up but they were down to 14 men two minutes later when centre Davies was yellow carded for tackling Scotland No.8 Johnnie Beattie -- another borderline call by Jackson, who was refereeing his first Six Nations match.
It was a see-saw penalty contest in the opening quarter of the second half, Laidlaw landing two and Halfpenny one, making it 19-16 to Wales.
The Scots survived a scare on the hour mark. Williams dived over in the left corner after a Welsh line-out drive but the score was chalked off because of obstruction.
It proved to be a temporary reprieve. In the 64th minute Wales had their second try and some breathing space, Davies bursting through the home defence to score under the posts and Halfpenny converting.
It might have been different had replacement scrum-half Sam Hidalgo-Clyne not been penalised for a knock on before centre Mark Bennett dotted down five minutes from time. Replacement lock Jim Hamilton barged over for a second Scotland try in the final minute but that, and Russell's conversion, left Cotter's men three points short.