Scott McDonald and Julio Arca gave them a two-goal cushion on Tuesday night but Dwayne Mattis cut the arrears and the home side went close to taking the tie into extra time.
Boro went into the first cup game at the new B2net stadium with a number of players missing on international duty but they silenced the home fans with an early goal. The Championship side broke quickly up the left in the eighth minute and Leroy Lita played in McDonald who slid a low shot past the right hand of Tommy Lee.
Chesterfield almost replied a minute later when Jack Lester's shot on the turn was cleared off the line by David Wheater and the striker also had a header pushed away by Jason Steele.
But Boro increased their lead in the 33rd minute when another swift counter saw Lita play in Arca whose shot should have been saved by Lee.
Chesterfield raised the tempo in the second half and were back in the game when Dwayne Mattis headed in Scott Griffiths cross from the left and Lester was denied a last minute equaliser by Steele.