Scott Boden gave the Spireites an early lead before Fisayo Adarabioyo equalised just before the half-hour mark.
Josh Hancock (62) scored from the penalty spot to put the hosts in front but Jordan Cropper equalised just a minute later with a well-taken low drive.
The Spireites applied some late pressure and had chances to win it with keeper Tony Thompson keeping them at bay.
A minute from time. Hancock broke through on the right-hand side of the area and slotted low past debutant keeper Corey Addai for the winner.
Report to follow later…