Goalkeeper Ryan Boot saved a stoppage-time penalty as Chesterfield's League Two play-off hopes received a huge boost after beating nearest rivals Grimsby.
A quickfire first-half double from Liam Mandeville and Lee Bonis was enough for Paul Cook's side, with Jaze Kabia reducing the deficit before Reece Staunton was denied from the spot in the fifth minute of time added on.
The home side took a 31st-minute lead as Mandeville swept home Lewis Gordon's cross.
The Spireites doubled their advantage three minutes later when Sammy Braybrooke's cross-field pass was expertly controlled and finished by Bonis.
In what was a chaotic end to the half, the Mariners halved the deficit in the 41st minute after Kabia smashed home from close range.
After the break, both sides saw efforts cannon off the upright, but it was stoppage-time heroics from Boot which helped earn all three points for the Spireites.
For the second game running, the shot-stopper produced a save from 12 yards as he kept out Staunton's spot-kick with almost the last kick of the game.
Match report supplied by PA Media.
Dyer: 'What a win'
Artell on 'disappointing' defeat at Chesterfield
