Gillingham celebrated a club record when a second half header from Cody McDonald earned an 11th away victory of the season as Martin Allen's promotion chasers won 1-0 at Chesterfield.
The Spireites started brightly but Gillingham were only denied a goal by a stunning save from Tommy Lee in the 10th minute to turn away a low shot from Chris Whelpdale.
Lee rescued his team again six minutes later when McDonald broke clear on the left but Chesterfield responded when Marc Richards fired just over from the edge of the box.
The Gills had been in control in the first half without breaking through but they scored five minutes after the interval when a Myles Weston corner to the near post was flicked in by the head of McDonald.
Chesterfield brought on Jack Lester and the veteran striker twice went close but, despite seven minutes of stoppage time, Gillingham stood firm to stay top of npower League Two.