Wales racked up their record fifth consecutive Six Nations away win to set up a potential title showdown with England in Cardiff next Saturday.
In a scrappy, stop-start encounter dominated by kicking, Leigh Halfpenny's 23-point haul via seven penalties and a conversion of the only try from Richard Hibbard proved decisive.
Greig Laidlaw's six penalties - in a match where a world record 18 were attempted - kept the hosts in touch until well into the final quarter.
But Halfpenny's final kick eight minutes from time gave the visitors a 10-point cushion, and despite a late Scottish rally, Wales' superb defence ensured a sixth consecutive win in the fixture.
It was the third game in a row in which the defending champions have not conceded a try, and maintaining that record in the face of a frantic late Scottish assault may yet prove crucial.
England, who are likely to extend their points difference (currently +36) advantage over Wales (+29) with victory over Italy on Sunday, remain strong favourites to win the championship.
But the defending champions have at least closed the gap to give themselves an outside shot at retaining their title with victory next Saturday.
Scotland, meanwhile, will travel to France in their final fixture hoping to finish a relatively successful campaign - they have won two matches for the first time since 2006 - on a high.
With a biting wind swirling around Murrayfield, both sides opted to put boot to ball, trying to force the opposition into mistakes.
Wales went in 13-12 ahead at half-time, though it could have been more. Halfpenny, with an 87% success rate after the first three rounds, missed three penalties in quick succession between the 15th and 21st minutes, before rediscovering his radar to nudge the visitors ahead with the last kick of the opening period.
The full-back had opened the scoring in the fourth minute after a series of scrums inside the Scottish 22. Referee Craig Joubert awarded Wales free-kicks at the first two, before Scotland were penalised for collapsing the third, giving Halfpenny an easy three-pointer in front of the posts.
But Laidlaw, who had landed 13 out of 14 in the championship so far, maintained his own superb kicking form.
The scrum-half levelled immediately when Ryan Jones infringed at a ruck from the restart, and put his side ahead after Wales strayed offside in midfield.
The visitors looked the more dangerous in attack, but with Halfpenny missing three kicks in a row, the breakthrough came via a welcome bit of enterprise instead.
George North stepped inside Richie Gray and made 40m up the right touchline in a rare break-out. Stuart Hogg made the initial tackle to bring down the Wales wing, but charges from Ryan Jones, Jamie Roberts and Mike Phillips took Wales up to the Scottish line, and Hibbard was bundled over.
Halfpenny nailed the conversion from wide out, but Laidlaw brought the hosts back to within a point with his third sweet strike after Wales were adjudged to have taken down another scrum.
Penetrative kicks from Matt Scott, Laidlaw and Duncan Weir pinned Wales back on their heels.
But the hosts suffered a major blow when lock Gray was taken off with a hamstring injury after half an hour, Al Kellock coming on to replace him.
Undaunted, the Scots produced the most memorable moment of an otherwise forgettable first half.
Weir, starting his first Test, chipped over the top of the onrushing Welsh defence, beat Halfpenny to the bouncing ball and kicked ahead to the line.
The fly-half then scragged Dan Biggar, forcing his opposite number to take the ball over his own line. But with the home crowd expectant, Scotland were penalised for an early engagement at the resultant scrum.
Perhaps by way of evening things up, referee Joubert then penalised Wales for collapsing the next scrum, on their own put-in.
Laidlaw's fourth penalty nudged Scotland ahead, only for lock Jim Hamilton to give away a needless penalty coming around the side of a ruck, allowing Halfpenny to send Wales in front.
The pattern continued on the resumption, with the blast of Joubert's whistle continuing to dominate proceedings.
Laidlaw fell short - his first miss of the day - from 45m, before Halfpenny nudged Wales out to a 16-12 lead after Scotland number eight Johnnie Beattie was harshly penalised.
Wales were enjoying territorial dominance, but on a rare incursion into the visitors' half, Scotland's powerful maul was brought down illegally and Laidlaw brought his side to within a point again.
Justin Tipuric coming on in his place, but two further Halfpenny penalties gave the defending champions a seven-point cushion.
Laidlaw's sixth penalty on the hour made it four, but after Wales managed to generate some forward momentum with Toby Faletau to the fore, Halfpenny restored the margin.
Belatedly, Scotland managed to get their dangerous back three into the game, two quick offloads taking Tim Visser to within striking range, only for a thumping tackle from replacement Scott Williams to halt the first decent Scottish move of the half.
But Wales' defence remained resolute, and despite losing prop Paul James to the sin-bin, they resisted the hosts' advances.
When Scotland were penalised for holding on with two minutes left, Wales' third consecutive "clean sheet" was assured, and thoughts could turn to spoiling England's party.
SCOTLAND: 15-Stuart Hogg, 14-Sean Maitland, 13-Sean Lamont, 12-Matt Scott, 11-Tim Visser, 10-Duncan Weir, 9-Greig Laidlaw; 1-Ryan Grant, 2-Ross Ford, 3-Euan Murray, 4-Richie Gray, 5-Jim Hamilton, 6-Robert Harley, 7-Kelly Brown (captain), 8-Johnnie Beattie.
Replacements: 16-Dougie Hall, 17-Moray Low, 18-Geoff Cross (for Murray, 76), 19-Alastair Kellock (for Gray, 30) 20-Ryan Wilson (for Beattie, 68), 21-Henry Pyrgos, 22-Ruaridh Jackson (for Weir, 78), 23-Max Evans.
WALES: 15-Leigh Halfpenny, 14-Alex Cuthbert, 13-Jonathan Davies, 12-Jamie Roberts, 11-George North, 10-Dan Biggar, 9-Mike Phillips; 1- Paul James, 2-Richard Hibbard, 3-Adam Jones, 4- Alun Wyn Jones, 5-Ian Evans , 6-Ryan Jones (captain), 7- Sam Warburton, 8-Toby Faletau.
Replacements: 16-Ken Owens (for Hibbard, 61), 17-Scott Andrews (for Faletau, 80), 18-Ryan Bevington, 19-Andrew Coombs, 20- Justin Tipuric (for R Jones, 49), 21-Lloyd Williams (for Phillips, 70), 22-James Hook, 23-Scott Williams (for Roberts, 70)
Referee: Craig Joubert (South Africa)