Macclesfield slipped into the relegation zone after second-half strikes from Matt Fish and Chris Whelpdale kept Gillingham's play-off challenge alive.
Fish scored his first goal for the club after 51 minutes before Whelpdale wrapped up a valuable three points for the Gills with nine minutes remaining to extend Macclesfield's winless run in 2012.
Gillingham nearly took the lead inside three minutes when Whelpdale's powerful shot deflected onto the foot of the post.
Matt Smith, twice, and Arnaud Mendy both should have done better with headers for the visitors but Gills finished the first half stronger with Danny Kedwell seeing his shot blocked on the line by Nat Brown.
The hosts went ahead just after the break when Lewis Montrose teed-up Fish for a smart finish but they were indebted to Paulo Gazzaniga's reflex save to keep out Vinny Mukendi's effort.
Whelpdale then connected with a diving header from Danny Spiller's cross and there was still time for substitute Rowan Vine to see a third goal ruled out.