Lincoln hung on for their first away win in two months and ended Mansfield's seven-match unbeaten run in a pulsating local derby between two promotion challengers.
The Stags, who fell behind for the second time five minutes into the second half created five clear chances to level in a one-sided finish.
But Tom Curtis twice fired wide when well placed, Iyseden Christie's snapshot was deflected into the side netting and then their unmarked striker headed wide before Rhys Day was denied by Alan Marriott's save on the line.
The Imps had got off to the best possible start, Richard Butcher robbing Lee Williamson in midfield and firing a 30-yard blockbuster into the top corner after just 3 minutes.
Mansfield hit back immediately with a spell of heavy pressure and it needed two fine saves by Marriott to beat away Liam Lawrence's close-range volley and then Curtis' long-range strike, The keeper again excelled when he held on to Junior Mendes' shot on the turn, but he was fortunate on the half hour when the unmarked David Artell prodded Wayne Corden's cross straight into the arms of the keeper.
The Stags finally converted one of their chances to level in the 34th minute. Paul Morgan gave the ball away in the area and when Ben Futcher tripped Christie, Lawrence converted his sixth penalty of the season.
In first-half injury time Lincoln should have regained the lead, keeper Kevin Pilkington dropping a long throw and Simon Yeo firing the loose ball into the side netting from six yards.
However, just five minutes later the Imps were back in front. The Stags again struggled to clear a long throw and when Mark Bailey found Peter Gain on the edge of the area the midfielder's low drive through a crowded penalty area found the bottom corner of the net.