Tranmere Rovers 3
A last-ditch Craig Westcarr goal saw Chesterfield book their ticket to the northern semi-final of the JP Trophy.
The Spireites edged the seven-goal thriller after twice coming from behind against the Rovers at the B2net on Wednesday evening.
Andy McGurk gave Tranmere an eighth minute lead with a dipping 25 yard effort before Alex Mendy made it 1-1 two minutes before half-time with a good shot.
Nine minutes into the second period, Jordan Bowery headed Chesterfield into the lead but 14 minutes later, Rovers sub Showunmi made it 2-2.
Within two minutes Tranmere went ahead again when on-loan keeper Ole Soderberg allowed a Mustafa Tiryaki shot to slip through his hands.
Bowery netted his second to square the game and just as it looked as if penalties were looming, Westcarr pounced to snatch a late victory.
Tope Obadeyi made his Spireites debut on loan for a month from Bolton and initially operated up the left flank where he looked to have pace to spare.
But after Tranmere went ahead there was a further blow when Drew Talbot, back in the team after a short spell of paternity leave, went down and was stretchered off suffering from mild concussion.
Simon Ford came on as a replacement and shortly before the break Mendy ran at the Tranmere defence from a central position and drove a powerful shot into the corner of the net.
Obadeyi switched to the right but Bowery’s first headed effort came from the other flank when he headed in Westcarr’s cross from close range.
Two goals in as many minutes saw Tranmere back in the box seat but it was Bowey levelled matters with 11 minutes remaining when he nodded in a neat cross from Mendy.
It appeared as if a shoot-out was looming but in the first minute of time added on the Spireites were awarded a free kick deep in Tranmere territory.
Danny Whitaker launched it into the danger area and Westcarr did the rest from a few yards out to close out the result.
Chesterfield: Soderberg, Mattis (Whitaker 77), Downes, Talbot (Ford 19), Smith, Mendy, Johnson (Allott 76), Grounds, Obadeyi, Westcarr, Bowery. Subs not used: Fleming, Clay.
Tranmere: Fon Williams, McChrystal, Taylor, Holmes, Buchanan, Bakayogo (Showunmi 57), Welsh, Weir, Akins, Tiryaki (Power 86), McGurk (Labadie 71). Subs not used: Coughlin, Raven, Labadie .
Referee: Geoff Eltringham (Tyne & Wear).
Attendance: 3,152 (253 from Tranmere).