Article continues below
Article continues below
Wales recorded their ninth successive victory over Scotland in the RBS 6 Nations Championship to stay firmly among this season's title contenders.
But they required tries during the last 15 minutes from centre Jamie Roberts and wing George North to subdue an impressive Scottish performance that saw the visitors lead midway through the second half.
Scrum-half Gareth Davies also touched down for Wales, courtesy of a magnificent early break, while fly-half Dan Biggar added three conversions and two penalties as Scotland's long wait for a win in Cardiff continued with a 27-23 defeat.
Outstanding wing Tommy Seymour and centre Duncan Taylor scored tries for Scotland, with skipper Greig Laidlaw adding 11 points from the boot and Duncan Weir adding a late conversion, yet they were ultimately outgunned during a game that saw them lose full-back Stuart Hogg - their sharpest attacking threat - due to a back injury.
Wales, after a draw in Dublin last weekend, will go top of the championship if they beat next opponents France, but Scotland have played two, lost two, following an opening 15-9 defeat at home to England.
While Wales went in with an unchanged team from Dublin, Scotland announced a late switch as London Irish wing Sean Maitland missed out because of hamstring trouble.
Sean Lamont moved off the bench to replace him, with Wasps fly-half Ruaridh Jackson, who had been due to feature for his Aviva Premiership club on Sunday, joining the back division substitutes alongside Sam Hidalgo-Clyne and Duncan Weir.
A closed stadium roof greeted Scotland's first Cardiff visit since they were crushed by a record 51-3 margin two years ago, while Wales were led out by centre Jonathan Davies on the occasion of his 50th cap.
Scotland threatened inside 60 seconds when full-back Stuart Hogg was freed in space by a Richie Gray pass, but Wales covered well and then gained a scrum penalty after their young Scarlets props Rob Evans and Samson Lee made an immediate presence felt.
And Wales opened the scoring in spectacular fashion after seven minutes when centre Jamie Roberts knocked possession back following an aerial collision and Davies pounced from 40 metres, outpacing Scotland's defensive cover to claim a sixth try in his last seven Test appearances.
Biggar added the conversion for a 7-0 lead after as many minutes but Scotland hit back following a spell of pressure when Russell kicked cleverly into space and Seymour finished off in the corner before Laidlaw's conversion tied things up.
Scotland flanker John Barclay led a break out of the visitors' half before his kick ahead only narrowly eluded centre Mark Bennett's clutches, then a Russell touchfinder pinned Wales back in their 22.
The visitors suffered a major injury blow 11 minutes before the break when Hogg went off to be replaced by Jackson. Yet it did not unsettle them as Laidlaw kicked a long-range penalty, making it 10-7.
Although Biggar quickly wiped out the deficit with a penalty, Laidlaw accepted another chance on the stroke of half-time and Scotland deservedly held the interval advantage.
Apart from a dominant opening 10 minutes, Wales had struggled to make headway, yet they began the second period in determined fashion, and after a strong George North run that saw play taken on by lock Luke Charteris, Biggar's second successful penalty brought the home side level.
Wales boss Warren Gatland made a triple substitution after 48 minutes, sending on prop Gethin Jenkins for his 121st cap, hooker Ken Owens and lock Bradley Davies in an attempt to grasp control of the contest up front.
But Scotland regained some initiative when Wales full-back Liam Williams slipped and knocked on just outside his own 22, and the visitors gained a scrum penalty that Laidlaw landed to restore a three-point lead.
The game was threatening to open up, which Wales illustrated through wing Tom James' 60-metre break that Scotland centre Duncan Taylor halted with a brilliant cover-tackle, yet the home side had territorial control and established scrummaging control five metres out which started answering serious questions of their opponents.
Wales skipper Sam Warburton opted against taking a close-range penalty for another scrum, and the game had unquestionably arrived at a key moment, which was confirmed when Roberts smashed his way over and Biggar's conversion put Wales four points clear.
North then sealed it for Wales as the clock ticked down, although Taylor added a later try for Scotland, setting up a Cardiff showdown with unbeaten title rivals France in 13 days' time.