Abdulai Bell-Baggie grabbed a late winner in extra time to send Tranmere in to the League Cup second round.
All the drama came late on after neither side could break the deadlock in normal time.
Cole Stockton gave the visitors the lead in the 93rd minute when he lashed in to the top corner from 12 yards out.
Chesterfield veteran Jack Lester levelled the score with a chipped effort but substitute Bell-Baggie secured the win at the death.
VIEW FROM THE DRESSING ROOM
Tranmere Rovers manager Ronnie Moore told BBC Radio Merseyside:
"I think we deserved it and the disappointing thing for me was that we had to go into extra time.
"Give our lads their due, we've kept going and you won't see a better goal that Bell-Baggie's.
"We had six players missing, including three centre-halves.
"For Ben Gibson to travel from Middlesbrough today, meet everyone in there, put on a shirt and then come out and play was unbelievable."
Chesterfield 01 Lee 03 Smith 04 Forbes 05 Trotman Booked 06 Hird Booked (Darwikwa - 76' ) 07 Allott 08 Togwell Booked 10 Whitaker Booked 25 Talbot 09 Richards (Lester - 67' ) 11 Westcarr (Bowery - 54' ) Substitutes 13 O'Donnell 12 Darwikwa 15 Clay 23 Randall 14 Lester 18 Boden 21 Bowery Tranmere 01 fon Williams 02 Holmes 14 Bakayogo Booked 19 Kay 21 Gibson 06 Palmer (Harrison - 112' ) 07 Thompson 08 Wallace Booked 10 Robinson (Power - 112' ) 16 Stockton 26 Akpa Akpro (Bell-Baggie - 100' ) Substitutes 33 Mooney 12 Harrison 15 Kirby 17 Power 20 Vaulks 22 Bell-Baggie