|Scarlets (13) 22|
|Tries: Allen Cons: S Shingler Pens: S Shingler, A Thomas 4|
|Edinburgh (3) 21|
|Tries: Du Preez, A Toolis Cons: Tonks Pens: Fowles, 2 Tonks|
Fly-half Aled Thomas kicked a late penalty as Scarlets triumphed after Edinburgh's fight-back from 19-6 down.
It was Thomas' fourth penalty in a Scarlets performance that began brightly with Morgan Allen's try.
Steve Shingler added a penalty before Thomas took over kicking duties.
Cornel du Preeze and Alex Toolis tries helped the visitors take the lead, but Scarlets held out after Thomas' final kick as they dropped to fourth in the table.
Leinster's bonus-point 52-0 win over Zebre sent them above Scarlets, while Edinburgh stayed fifth.
Lock David Bulbring made his Scarlets debut after arriving from South Africa while Kirby Myhill started at hooker.
Edinburgh made four changes as wing Damien Hoyland returned and Sam Beard was at centre for the injured Chris Dean.
Anton Bresler and Ben Toolis were a new-look second row for the Scots.
The home side seized the early initiative to build a 13-3 lead by the break. Allen was set free for his try, converted by Shingler before the fly-half added a penalty.
Fowles put Edinburgh on the scoreboard midway through the opening period with his first shot at goal and added a second soon after the break.
Thomas added two more penalties before Edinburgh's fight-back began and Greg Tonks' penalty rewarded Edinburgh's momentum.
Replacement lock Toolis finished off in style out wide and Tonks' conversion put them into the lead with six minutes left.
But Scarlets fought their way back upfield and were awarded a penalty that gave Thomas the chance to seal the win.
Scarlets head coach Wayne Pivac said: "We're obviously happy and relieved. It was really important to get a win today with a couple of away games coming up.
"We were certainly disappointed to fall behind 21-19.
"That was a massive result; there was a big improvement, but still some errors."
Scarlets: Michael Collins; Gareth Owen, Regan King, Hadleigh Parkes (c), DTH van der Merwe; Steven Shingler, Rhodri Williams; Phil John, Kirby Myhill, Peter Edwards; George Earle, David Bulbring; Aaron Shingler, Will Boyde, Morgan Allen.
Replacements: Ryan Elias for Myhill, 74), Dylan Evans (for John, 74), Rhodri Jones (for Edwards, 52), Rory Pitman (for Boyle, 59), Aled Davies (for R Williams, 57), Aled Thomas (for S Shingler, 21),
Not used: Steff Hughes.
Edinburgh: Greig Tonks; Damien Hoyland, Michael Allen, Sam Beard, Tom Brown, Phil Burleigh, Nathan Fowles; Rory Sutherland, Neil Cochrane, John Andress, Anton Bresler, Ben Toolis, Mike Coman (c), Hamish Watson, Cornell Du Preez.
Replacements: George Turner (for Cochrane, 24), Allan Dell (for Sutherland, 44), Simon Berghan (for Andress, 61), Alex Toolis (for Coman, 55), Jamie Ritchie (for Watson, 55), Sean Kennedy (for Fowles, 51), Blair Kinghorn (for Allen, 70), Dougie Fife (for Hoyland, 51).
Referee: Andrew Brace (IRFU)
Assistant Referees: Craig Evans, Greg Morgan (both WRU)
Citing Commissioner: Dennis Jones (WRU)
TMO: Jon Mason (WRU)