The Stags came into the game having not found the net in their last three games in all competitions and they were behind after four minutes.
There was no shortage of pressure from the visitors, however, who threatened the Cobblers goal on numerous occasions.
But a Northampton side, who have now lost just once in their last 11 league games, survived a handful of scares to escape with victory.
The Stags were behind after just four minutes when Alfie Potter picked up the ball inside his own half, travelled all the way to the byline and crossed for Richards to head home.
Mansfield spurned two quickfire chances to equalise seven minutes later, the lively Matt Green let down by his touch before Craig Westcarr fired wide of the target from the edge of the area.
Aside from picking the ball out of his net, Stags goalkeeper Brian Jensen had very little to do inside the first half-hour, while Ryan Tafazolli headed a corner wide from six yards out at the other end.
Jensen was called into action five minutes before the break, however, when he palmed away Nicky Adams’ effort, before Green headed Blair Adams’ free-kick against the woodwork on the stroke of half-time.
Dominic Calvert-Lewin – on for Potter at half-time – was next to be denied by the woodwork, ghosting in behind the Mansfield defence to flick a dangerous cross against the crossbar.
That sparked the Stags into life, following a slow start to the half, but two teasing crosses from substitute Matty Blair went begging on the hour mark.
Ade Yussuf shot wide shortly after coming off the bench, while Jensen denied Joel Byrom at the other end but it finished 1-0.