Gillingham are still in with a chance of clinching automatic promotion after a Mark McCammon header and a gritty defensive display denied Chesterfield who fell out of the play-off places as a result of their defeat.
McCammon's 22nd-minute goal - his fifth of the season - was enough to give Gillingham the points but Chesterfield had the chances to have at least earned a draw.
Gillingham had to defend at full stretch for much of the second half and goalkeeper Simon Royce also made a crucial save to deny Jack Lester from close range.
Lester has been one of the top marksmen in the lower leagues this season but he wasted the sort of chance he normally tucks away early in the match when Gregor Robertson set him up from 12 yards.
Ten minutes later, John Nutter crossed from the right and McCammon's powerful header beat Tommy Lee and went in off the crossbar.
Although Gills skipper Barry Fuller was cautioned for a blatant check on Drew Talbot, there was little else to trouble the visitors before half-time, but it was a different story in the second half.
Chesterfield, driven forward by the excellent Derek Niven, laid siege to the Gillingham goal, but a combination of excellent defending and wasteful finishing left them empty-handed.
Kevin Austin was unlucky when he thumped a header against a post in the 68th minute and Royce made his best save of the day ten minutes later when Lester wriggled clear of two defenders only to see his shot blocked by the goalkeeper's body.
Royce needed lengthy treatment before he could continue and there were more alarms inside the Gillingham penalty area when Niven shot wide in the 86th minute after Mark Bentley had lost possession.
But with Garry Richards outstanding in central defence, the visitors held on, although Chesterfield had one more excellent opening at the end.
A long ball from Dan Gray was flicked on by Martin Gritton to send substitute Scott Boden in on goal but the youngster blazed high into the home supporters and Gillingham were able to celebrate another vital victory.