A goal early in each half helped Scunthorpe into the second round of the Carling Cup for the first time in three seasons.
But they were made to fight hard by League Two side Chesterfield who were twice denied by goal-line clearances.
Drew Talbot almost put the visitors in front in the 11th minute direct from an in swinging corner which was cleared off the line by full-back Marcus Williams.
But Scunthorpe then broke straight down the other end of the field to open the scoring when Gary pulled back a low cross from the right perfectly into the path of midfield man Matt Sparrow to beat goalkeeper Tommy Lee from close range.
Chesterfield might have been back on level terms when striker Martin Gritton, who was an awkward customer for the home defence, drifted a close range header just wide.
A minute later Gritton was involved again setting up a chance inside the box for Jordan Bowry which he dragged wide of the target.
Scunthorpe's movement up front began to pose problems for Chesterfield and twice they came close to adding to their score.
First Paul Hayes had a close range shot well blocked by Lee and then the visiting keeper flung himself full length to turn away a well-struck effort from midfield man Michael O'Connor.
United made it 2-0 after 54 minutes when Paul Hayes rifled home the rebound after Lee had done well to block away a free-kick from O'Connor.
Hayes and Hooper might have added to the score as Scunthorpe looked comfortably in command.
But Chesterfield kept battling away and were rewarded when substitute Darren Currie netted from the penalty spot after 72 minutes after Talbot had been brought down in the box by Rob Jones.
The visitors pressed strongly for an equaliser in the closing stages and were unlucky when a close range effort from Bowry was cleared off the line by Williams.
It was Scunthorpe who were relieved to hear the final whistle, looking uncertain in defence, under pressure and giving away possession too easily to Chesterfield who will feel unlucky not to have forced at least extra time.