Rhys Priestland kicked three penalties and converted a try from man-of-the-match Jonathan Davies, with the result sending the Welshmen back into second place in the table.
Full-back Chris Paterson did all the scoring for Edinburgh - notching a try, a conversion and three penalties - but could not halt the Scots' slide to their first defeat at Murrayfield since September.
It was the Scarlets who made the brighter start and they had an early try-scoring chance. A loose pass from Edinburgh scrum half Mike Blair was hacked on by Scarlets flanker Richie Pugh into the in-goal area, but the fit-again Paterson darted back to avert the danger.
Moments later, an infringement at the scrum gave Priestland the opportunity to put his side in front. He duly obliged and he then doubled the Scarlets' advantage with a second successful kick in the 20th minute.
Then, Edinburgh fly-half David Blair got his side on the move with an electrifying, mazy run which yielded three points. The move petered out, but the penalty award at the resulting ruck enabled Paterson to put his side on the scoreboard.
Classy Scarlets centre Regan King made light work of the challenging underfoot conditions as he danced his way through the home rearguard on 25 minutes. His attempted inside offload ricocheted of the backtracking John Houston, but full-back Stoddart was unable to collect the ball as it lay inches from the line.
Edinburgh winger Tim Visser, the league's top try scorer this season, had to show is defensive qualities when putting in a crucial tackle on Gareth Maule as he burst forward.
David Blair made another sizzling break, from which Lee Jones was thwarted by the covering Sean Lamont. But the hosts managed to draw level with Paterson converting a penalty on the stroke of half-time.
The second half began with a flourish, Stoddart making amends for his earlier failure by diving over in the corner a minute after the restart. Davies was the key man in the build-up, finding a gap in the Edinburgh defence before passing for Stoddart to score.
Priestland was off the mark with the conversion attempt but stretched his side's advantage with a third successful penalty, only for Paterson to respond in similar fashion.
Bustling centre Davies then gave a timely reminder to Wales coach Warren Gatland of his return to fitness, as he capped a fine display with a try. He romped over in the corner, having successfully fended off the Edinburgh defenders.
Priestland once again converted to make it 21-9 to the Scarlets, whose last win in Scotland was at the now defunct Border Reivers in November 2006.
And there was further good news for Gatland as fly-half Stephen Jones made his return from a shoulder injury by coming on for the final 17 minutes.
The introduction of fresh legs appeared to spark Edinburgh into life, with replacements Greig Laidlaw and Simon Webster combining to send Webster storming over, only for the score to be chalked off after the final pass was deemed to have gone forward.
Hopes of a late comeback were fuelled when Paterson took a pass from replacement James King to go in under the posts and finish off a clinical move for a converted score, but the visitors withstood a late onslaught to take a valuable four points back home.
|Edinburgh Rugby Score Card|
|Scarlets Score Card|