A wonder goal from Chesterfield's Derek Niven pushed Manchester City into deeper trouble.
Niven's superbly struck second-half winner meant that Stuart Pearce's team have now lost three games in a row.
But in truth the Premiership team went out of the Carling Cup with a whimper despite fielding a full strength team against their League One opponents.
Chesterfield were first to virtually every ball and fully deserved their place in the third round of the competition.
Yet City had early chances to go in front with both Georgios Samaras and Bernardo Corradi wasting chances in the first five minutes. After that the City attack was rarely seen and Chesterfield took control.
They should have gone in front on the half hour when Niven set up Caleb Folan, but the big striker shot over from ten yards.
Folan twice caused City defence more problems, but five minutes before the break the visitors took the lead.
Micah Richards forced his way down the right flank and his cross found ahead of Corradi.
The big striker's effort came back off the foot of the post, but Samaras followed up to score. It was the first goal scored by a City striker this season.
Chesterfield continued to look dangerous in the second half and Folan equalised in the 51st minute with a downward header from six yards.
The Spireites kept up the pressure and deservedly took the lead in the 67th minute. Skipper Mark Allott did well to keep the ball in play before firing in a cross from the left.
The ball was headed out straight to Niven, whose volley flew straight back into the top corner, leaving Nicky Weaver helpless.
City looked dispirited and even when they threw men forward they rarely looked like levelling things up.
Corradi headed narrowly over after he was picked out from a corner by Joey Barton. Then substitute Ishmael Miller saw an effort saved by home keeper Barry Roche.
Miller caused Chesterfield problems down the left flank and his 85th minute cross set up Stephen Ireland, but the substitute shot straight at Roche.
Then, in the final minute, Richard Dunne put an effort wide as Chesterfield hung on for victory.