Gillingham leapfrogged opponents Notts County into the League Two play-off positions after coming from behind to win at Meadow Lane.
Dan Crowley put County ahead but Gillingham responded through goals from Oli Hawkins, Max Clark and Conor Masterson to claim a win that lifts them up to seventh place, two points above the Magpies.
The hosts took a 13th-minute lead when Crowley took aim from outside the area and curled the ball in off the post, set up by Jodi Jones who now holds the record for the most assists in a League Two season with 17.
But the Gills responded seven minutes later when Masterson was given time to cross the ball into the area for Hawkins to head beyond Aidan Stone.
And the visitors went into the break in front when Clark was picked out at the back post, producing a brilliant first-time finish with the outside of his foot.
Gillingham increased their lead eight minutes after the restart as County failed to clear a corner, allowing Masterson to stoop low and head home.
And they almost furthered their advantage late on when Tim Dieng struck both posts with a header, with Masterson almost getting his second as his header looped over the bar.
Match report supplied by PA Media.