Grant McCann's side had to come from behind but were helped when the hosts had a man sent off in the second half, eventually managing to turn the screw and seal a place in Monday’s draw.
Jordan Gibson fashioned the first chance of the game when he latched onto a brilliant forward ball through the middle by Luke Molyneux. Gibson advanced towards goal but saw a shot smothered by the onrushing Zach Hemming in the home goal.
The hosts had to wait until the half-hour mark for their first proper venture forward when Lee Bonis saw a shot deflected just past the post and out for a corner.
Thimothee Lo-Tutala then made an excellent save to keep out a Liam Mandeville shot but it fell right into the path of Bonis who gleefully tapped in for his second goal against Rovers in as many games.
The visitors weren't behind for long, mind. Skipper Owen Bailey was on hand to plant home a header from a glorious Molyneux cross from the right.
The Spireites started the second half brighter and Mandeville prodded a shot just wide a few yards out before Rovers went forward and saw Molyneux go close after a quick breakaway.
The game's turning point then came on the hour when John Fleck was shown a straight red card for a lunging tackle on Bailey - he'd only been brought on as a sub five minutes earlier.
Rovers then sought to make the man advantage count as Molyneux fired a warning shot that was straight at Hemming before the over-worked stopper tipped a long-range Jamie Sterry striker over the bar.
Sub Billy Sharp thought he'd scored from just a few yards out only for the assistant referee's flag to quickly rule it out for offside. But another sub eventually popped up with the winner when Jack Senior fired home from distance to finally break Chesterfield's stubborn resistance.
Here's how we rated the Rovers players in Derbyshire:

1. Thimothe Lo-Tutala 7
Unlucky with the opener as he made a terrific save to keep out Mandeville's fierce effort only for it to fall right at Bonis' feet. Precious little else to concern him aside from that. Photo: Howard Roe/AHPIX LTD

2. Jamie Sterry 7
Got caught out a few times by the lively Duffy. Bright going forward with a few sighters as Rovers looked to make the man advantage count, and came close on a couple of occasions. Photo: Howard Roe/AHPIX LTD

3. Connor O'Riordan 7
Similar to McGrath, he was diligent in what he had to do and made some vital headers at vital times. Photo: Howard Roe/AHPIX LTD

4. Jay McGrath 7
Solid enough at the back aside from a few dicey moments. Forming a good partnership with O'Riordan. Got the assist for the winner. Photo: Howard Roe/AHPIX LTD

