The Minstermen, who have a game in hand on 20th-placed Torquay, recorded a third victory in five games thanks to goals from Simon Heslop, Vadaine Oliver and Jon Parkin.
Heslop gave the visitors a seventh-minute lead when he fired a 25-yard drive past former York goalkeeper Scott Flinders.
And Oliver made it 2-0 eight minutes later, slotting past Flinders from close range.
Macclesfield pulled a goal back from the penalty spot in the 58th minute when Dan Parslow's handball allowed Danny Whitaker to stroke home.
But Parkin made sure of an away win with eight minutes left when he forced the ball home following a Sam Muggleton long throw.
Match report supplied by the Press Association.
York moved within four points of escaping the National League relegation zone with a win at Macclesfield.