A Samu Manoa try and Stephen Myler conversion and penalty gave Northampton the lead before Dan Biggar landed two penalties for the visitors.
Christian Day's converted try made it 17-6 at the break, only for Ospreys to hit back through a try, conversion and penalty from Biggar.
But Ben Foden added a third Northampton try and Myler's boot saw Saints home.
Ex England and Saints fly-half Paul Grayson on 5 live
"Saints had the Ospreys at arms' length from the first five minutes. I thought Ospreys were going to come and throw some shots with their big forward pack and lots of Lions in there, but they were comfortably second best in lots of departments.
"One plus was Dan Biggar's goal-kicking from long range but if that is the highlight, then they need to have a hard look at themselves. If your strength lies up front, that is where you have to put the squeeze on but they failed to do that."
The hosts will be frustrated not to have secured a bonus point for scoring four tries, with George Pisi held a couple of feet short from a last-gasp Northampton attack, but in the end they were convincing winners.
Lawes, along with fellow England forwards Dylan Hartley and Tom Wood, was outstanding in all facets of the game, although the lock's work at the line-out and in the tackle - he made 20 - was particularly noteworthy.
And the 6ft 7in second row set the tone from the first whistle as he drilled Tom Habberfield backwards when the Ospreys scrum-half caught the kick-off.
George North then hammered into midfield and an Ospreys offside gave Myler the chance to kick the hosts into the lead.
When Manoa picked up from the base of a five-metre scrum and went over untouched, with Myler converting, with less than 15 minutes played it seemed as though Northampton were set for an easy win.
But Ospreys, who went into the game on the back of a disappointing home defeat by Leinster, were determined to put up a fight and two Biggar penalties cut the gap to four points.
However, Northampton were looking by far the more threatening side and they added to their lead almost immediately.
Luther Burrell made a couple of big carries into midfield before the hosts went wide and Lawes - who had started things with a soaring line-out take - sent second row partner Day over in the corner for a converted score.
It was turning into a spectacular game, with Northampton fizzing the ball about at pace but unable to finish things off, and the visitors prepared to counter-attack whenever they were presented with the opportunity.
They turned round 17-6 down, needing to score next if the match was not to run away from them, and they duly lifted their game after the restart.
Captain Alun Wyn Jones was at the heart of their charge and after he was held inches short, Biggar wriggled his way over by the posts before adding the conversion.
Suddenly there were only four points in it and Northampton's cause was not helped as Myler missed a simple penalty, but approaching the hour mark they stretched clear again.
The Saints pack bullied their way to within inches of the line from a line-out drive before Lee Dickson sent full-back Foden over unopposed.
Myler converted from out wide and an exchange of penalties by the two fly-halves concluded the scoring, with a potentially important fourth try for Saints proving elusive.
Northampton boss Jim Mallinder:
"Courtney Lawes was sensational, not just in his restarts, but his defence as well. He is consistently making big tackles, he consistently makes big carries and he is doing that for 80 minutes now.
"He was in and out of games a little bit in the past, now he is a complete player for the full game.
"It was a satisfying win for us. We played well and scored three really good team tries. It would have been lovely to have sneaked a bonus point at the end, but it means we are going into
the back-to-back games against Leinster in December
with everything to play for."
Ospreys head coach Steve Tandy:
"We were down 17-6 at half-time, and when we got back to 17-13 I really did think we were going to turn the corner. We were building momentum, but we conceded a sloppy try.
"No-one has ever qualified from losing their first two games, but we will be preparing for Castres in December as if we are still involved. We need to pick up points and wins."
Foden; Elliott, G Pisi, Burrell, North; Myler, L Dickson; A Waller, Hartley, Ma'afu, Lawes, Day, Dowson, Wood, Manoa.
K Pisi for Elliott (75), Fotuali'i for L. Dickson (62), E Waller for A Waller (69), Haywood for Hartley (75), Denman for Ma'afu (61), Clark for Dowson (55), van Velze for Manoa (55).
Fussell; Hassler, Bishop, Beck, Walker; Biggar, Haberfield, Bevington, Hibbard, A Jones, AW Jones, King, R Jones, Tipuric, Bearman.
Morgan for Beck (72), D Jones for Bevington (62), Baldwin for Hibbard (69), Jarvis for A Jones (54), Lewis for King (69), Ardron for R Jones (54), Allen for Bearman (47).
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.