© Getty Images
Steven Shingler got the visitors on the board with a penalty, but the Saints looked to have extended their lead when Luther Burrell capitalised on a turnover to score, only to see his effort ruled out as George North was sent to the sin bin for a foul.
Shingler brought his team within a point just before the break as he held his composure to send another kick from distance through the posts.
In the second half, Scarlets took the lead when Gareth Davies finished a flowing move to find the tryline, although the resulting conversion was missed by Shingler.
Northampton responded immediately to regain the advantage as they produced a driving maul towards the line and Alex Waller found his way through the bodies to touch down for the score, but Hanrahan missed the conversion.
Jamie Gibson became the second Saints' player to be sent to the sin bin in the 64th minute, but it not affect his side as they extended their lead through a penalty kick from Hanrahan.
Scarlets spurned the chance to pull back within a point as Aled Thomas saw his kick clatter off the post.
The Welsh side put the pressure on late in the match, but the Saints held out to secure the win.