Chris Whelpdale brilliantly opened the scoring on 24 minutes after winger Myles Weston capitalised on a slip from County defender Gary Liddle.
From his cross, Whelpdale chested down the ball and hit a low drive on the turn past County keeper Bartosz Bialkowski.
Whelpdale turned provider for Gillingham's second shortly after, as Danny Kedwell latched on to his through-ball to fire in his sixth goal of the season.
Callum McGregor scored a brilliant consolation for the visitors with a solo effort from 25 yards 11 minutes from time.
Magpies duo Mark Fotheringham and Alan Sheehan had wasted opportunities to open the scoring and Jamal Campbell-Ryce hit the bar shortly before half-time with a curling effort.
A Leon Legge half-volley and a Whelpdale effort from 25 yards were the closest the Gills came to extending their advantage as they picked up their third win in the five.