Last year's Grand Slam champions will face England in Cardiff in a title showdown next week but a big win for England against Italy on Sunday will effectively secure them the title as they already have a seven point advantage over the Welsh on point difference.
This victory in Edinburgh will still be immensely satisfying for the Welsh though, even if it was pretty putrid viewing for the neutral for long periods.
The match saw a Six Nations record 13 penalties scored (two more than the previous record) with Leigh Halfpenny kicking seven and Greg Laidlaw getting six.
The two men also missed five penalties between them too as the referee's whistle played a bigger part in the match than any one individual.
Richard Hibbard got the only try of the match in the first-half, while Lions hopefuls Richie Gray (hamstring) and Ryan Jones (shoulder) were both forced off with injuries.
However, the match did mark a triumphant return to the Welsh starting line-up for Sam Warburton, who was handed the man-of-the-match award for making 13 tackles and forcing three turnovers.
Wales edged a messy first-half 13-12 that was riddled by a host of penalties, disjointed scrums and stop-start action.
The Welsh largely dominated possession and had more chances with the boot but Halfpenny uncharacteristically missed three kicks in a row when the score was 6-3 to Scotland as the hosts kept their noses in front thanks to two kicks from Laidlaw.
Wales did get in front thanks to a try in the 22nd minute as Hibbard powered forward from close range. The attack was set up by a George North break into the 22' and then Wales showed great hands to recycle the ball a couple of times to edge ever closer before Hibbard touched down and Halfpenny converted.
Laidlaw has been kicking superbly throughout the championship though and the Scotland scrum-half fired over two more exceptional penalties to put Scotland 12-10 in front as he punished Welsh ill-discipline with perfect four for four kicking in the opening 40 minutes, despite none of his efforts being straightforward.
However, Wales ensured they would go in at the break in front, when Jim Hamilton stupidly grabbed Welsh scrum-half Mike Phillips before he played a ball out, allowing Halfpenny to kick a straightforward penalty in front of the posts.
There was also a major blow for the Scots on the half-hour when Gray was forced off with what initially looked like a serious looking knee injury, but reports emerged later that it was only a hamstring issue.
Laidlaw finally missed a penalty just out of his range early in the second-half and Halfpenny converted at the other end to put Wales 16-12 in front.
Laidlaw made it a one point game with yet another penalty but that was as close as Scotland would get. They were charged with engaging at the scrum too early for the fourth time in the match in the 56th minute and Halfpenny was able to kick over for the second time from such an incident to make it 19-15 and a sweet hit from him just three minutes later gave Wales a seven point buffer.
The penalties continued and Laidlaw got Scotland back in touch in the 61st minute but then three minutes later he missed a good chance to close the gap to just one point again.
Halfpenny was then able to kick two more penalties to make it 28-18 by the 72nd minute and some great defending in the final five minutes ensured Wales would clinch the win and take their title hopes into the final weekend.