Danny Wright ensured Wrexham came from behind to end Mansfield's 12-game winning run and keep alive their own title hopes with a vital victory.
Matt Green scored his 20th goal of the season from close range to give Mansfield the lead.
Wrexham were level when Dean Keates's free-kick took a slight deflection to beat Alan Marriott.
Wright secured the winner when he latched on to substitute Glen Little's excellent pass to sweep the ball home.
In a frenetic match Wright also saw an effort come back off the underside of the crossbar late on while Keates blasted over the crossbar in stoppage-time.
Third-placed Wrexham are seven points behind Mansfield, having played the same amount of games and with two in hand over leaders Kidderminster.
A win for Mansfield would have seen them set a new Football Conference record as well as going a point clear at the top.
VIEWS FROM THE DRESSING ROOM
Wrexham player-manager Andy Morrell told BBC Radio Wales:
"I'm really pleased for the lads - we got a slice of luck for once. They are working so hard for each other and for themselves.
"It was tight [and] both teams were going for it which was great to see.
"I thought in the second half we were tremendous and kept the pressure on and we could probably have won it by more in the second half. That's a big win for us."