A Cody McDonald hat-trick helped Gillingham beat managerless Stockport.
McDonald fired in from the edge of the area to put the visitors ahead, before setting up Andy Barcham, who smashed in to double the lead.
McDonald nodded Danny Spiller's cross for the third, before debutant loan man Ishmel Demontagnac headed in for 3-1.
Curtis Weston then dribbled upfield and slotted in to restore the two-goal lead, before McDonald headed in a Luke Rooney cross to complete his hat-trick.
Stockport County caretaker manager Peter Ward told BBC Radio Manchester: "We came up against a side who are bang in form, but that's no excuse. We should be doing better than what we did and we shouldn't be conceding five at home.
"With hard work on the training ground, I think we can turn things round but there has to be a lot of hard work from now until the end of the season.
"When we lost possession we were too naive and wide open and they were just playing long balls down the middle. They could drive a London bus down the middle."
Gillingham striker Cody McDonald told BBC Radio Kent: It was a great team performance, we knew it was going to be a tough game but we scored some important goals at important times.
"The boys have been creating the chances for me. It was good to score a hat-trick today, I was disappointed against Stevenage, but hopefully we can carry on as a team now
"The manager said we had to bounce back, maybe after the run we felt a bit of pressure maybe but it was a good performance all round."
93:04 The game is over, as the referee blows his whistle.
90:00+2:46 The ball is crossed by Mark Lynch, clearance by Andy Barcham.
90:00+1:51 Unfair challenge on Stefan Payne by Adam Griffin results in a free kick. Barry Fuller takes the free kick.
90:00+0:09 Foul by Josh Gowling on Wes Fletcher, free kick awarded. Free kick taken by Greg Tansey.
89:22 David Poole produces a left-footed shot from just outside the box that misses to the right of the goal.
87:47 David Poole takes a shot. Blocked by Danny Jackman.
87:29 A cross is delivered by Ishmel Demontagnac, Luke Rooney manages to make a clearance.
87:12 Adam Griffin crosses the ball, clearance made by John Nutter.
86:21 Free kick awarded for a foul by Wes Fletcher on Barry Fuller. Direct free kick taken by Alan Julian.
85:55 Danny Spiller challenges Wes Fletcher unfairly and gives away a free kick. Adam Griffin restarts play with the free kick.
85:14 Substitution (Gillingham) makes a substitution, with Garry Richards coming on for Matthew Lawrence.
83:32 The ball is delivered by Wes Fletcher.
82:56 Andy Barcham crosses the ball.
81:08 The offside flag is raised against Stefan Payne. Greg Tansey takes the free kick. Anthony Elding takes a shot. Save made by
Alan Julian. Inswinging corner taken from the left by-line by Greg Tansey.
80:32 Substitution Cody McDonald leaves the field to be replaced by Stefan Payne.
78:12 Centre by Cody McDonald, assist on the goal came from Luke Rooney.
78:12 GOAL - Cody McDonald:Stockport 1 - 5 Gillingham Cody McDonald grabs a headed goal from close range. Stockport 1-5 Gillingham.
76:35 Corner taken by Greg Tansey from the left by-line. Outswinging corner taken by Greg Tansey from the left by-line played to
the near post, Matthew Lawrence manages to make a clearance.
75:01 Substitution Luke Rooney on for Curtis Weston.
74:43 Corner taken by Ishmel Demontagnac from the right by-line.
74:28 Shot from outside the box by Anthony Elding misses to the left of the goal.
73:21 Substitution (Stockport) makes a substitution, with David Poole coming on for Robbie Williams.
70:02 Assist by Danny Jackman.
70:02 GOAL - Curtis Weston:Stockport 1 - 4 Gillingham Curtis Weston grabs a goal from inside the penalty box to the bottom right corner of the goal. Stockport 1-4 Gillingham.
69:29 Foul by Curtis Weston on Adam Griffin, free kick awarded. Greg Tansey takes the free kick. Assist by Greg Tansey.
69:29 GOAL - Ishmel Demontagnac:Stockport 1 - 3 Gillingham Ishmel Demontagnac finds the net with a headed goal from close range. Stockport 1-3 Gillingham.
67:58 Danny Jackman takes a shot. Blocked by Matthew Glennon. Danny Jackman takes a shot. Matthew Glennon makes a save.
65:29 Curtis Weston takes a shot. Matthew Glennon makes a save. Cody McDonald takes a shot. Blocked by Jordan Rose.
64:13 Substitution Stephen Husband goes off and Adam Griffin comes on.
63:47 The ball is delivered by Andy Barcham, save by Matthew Glennon.
62:36 Free kick awarded for an unfair challenge on Kevin Maher by Ishmel Demontagnac. Alan Julian takes the direct free kick.
60:57 Unfair challenge on Curtis Weston by Ishmel Demontagnac results in a free kick. Kevin Maher takes the free kick.
55:57 Cody McDonald crosses the ball, assist on the goal came from Danny Spiller.
55:57 GOAL - Cody McDonald:Stockport 0 - 3 Gillingham Cody McDonald finds the net with a goal from close range to the top left corner of the goal. Stockport 0-3 Gillingham.
53:24 Curtis Weston takes a shot. Save by Matthew Glennon.
50:33 Assist by Cody McDonald.
50:33 GOAL - Andy Barcham:Stockport 0 - 2 Gillingham Goal scored by Andy Barcham from inside the box low into the middle of the goal. Stockport 0-2 Gillingham.
49:19 Ishmel Demontagnac produces a left-footed shot from just outside the box that goes wide left of the target.
49:05 The ball is delivered by Robbie Williams, clearance by Matthew Lawrence.
46:24 Inswinging corner taken from the right by-line by Stephen Husband. The ball is delivered by Ishmel Demontagnac, clearance
by Josh Gowling.
46:17 The ball is delivered by Ishmel Demontagnac, Josh Gowling makes a clearance.
45:54 Corner taken by Greg Tansey from the right by-line, Alan Julian makes a save.
45:44 The ball is swung over by Robbie Williams, clearance made by Curtis Weston.
45:01 The game restarts for the second half.
45:01 Substitution Paul Turnbull comes on in place of Mansour Assoumani.
45:00+2:07 The first half comes to an end.
45:00+1:40 Ishmel Demontagnac takes a shot. Alan Julian makes a save.
45:00+1:22 Robbie Williams produces a cross, Josh Gowling makes a clearance.
44:41 The offside flag is raised against Ishmel Demontagnac. Free kick taken by Alan Julian.
43:01 Corner taken left-footed by Danny Jackman from the right by-line, Matthew Lawrence takes a shot. Inswinging corner taken left-footed
by Danny Spiller, Matthew Glennon makes a save.
40:18 The ball is sent over by Kevin Maher, Mansour Assoumani manages to make a clearance. Greg Tansey takes a shot. Barry Fuller
gets a block in. Corner taken by Greg Tansey from the left by-line, save by Alan Julian.
39:34 Foul by Mansour Assoumani on Curtis Weston, free kick awarded. Danny Jackman restarts play with the free kick.
38:46 The ball is sent over by Wes Fletcher, clearance made by Josh Gowling.
38:24 The offside flag is raised against Cody McDonald. Matthew Grieve takes the free kick.
36:37 Barry Fuller takes a shot. Matthew Glennon makes a save.
35:36 Danny Spiller fouled by Greg Tansey, the ref awards a free kick. Direct free kick taken by Kevin Maher.
31:29 Assist by John Nutter.
31:29 GOAL - Cody McDonald:Stockport 0 - 1 Gillingham A goal is scored by Cody McDonald from the edge of the penalty box to the bottom right corner of the goal. Stockport 0-1
30:03 The ball is crossed by Robbie Williams, clearance by John Nutter.
26:41 Unfair challenge on Cody McDonald by Matthew Grieve results in a free kick. Danny Jackman has an effort direct from the free
25:16 Free kick awarded for a foul by Danny Jackman on Stephen Husband. Stephen Husband takes the direct free kick.
20:42 Andy Barcham sends in a cross, clearance by Robbie Williams. Inswinging corner taken by Danny Jackman, clearance by Matthew
18:58 Mansour Assoumani concedes a free kick for a foul on Danny Spiller. Free kick taken by Danny Jackman. Shot from outside the
box by John Nutter misses to the left of the target.
18:24 Curtis Weston delivers the ball, Jordan Rose gets a block in.
17:44 Inswinging corner taken right-footed by Danny Spiller from the left by-line, Header on goal by Cody McDonald from inside the
box goes harmlessly over the target.
11:42 Andy Barcham produces a cross.
7:20 Wes Fletcher takes a shot. Josh Gowling gets a block in.
4:05 Greg Tansey takes a shot. Blocked by Matthew Lawrence. Ishmel Demontagnac takes a inswinging corner from the right by-line
played to the near post, Shot by Jordan Rose from deep inside the penalty area misses to the left of the target. Free kick
awarded for a foul by Andy Barcham on Ishmel Demontagnac. Greg Tansey takes the direct free kick.
1:16 Barry Fuller produces a left-footed shot from deep inside the penalty box which goes wide of the left-hand upright. Corner
from left by-line taken by Danny Jackman.
0:00 The ref blows the whistle to start the match.
Live text and data provided by The Press Association.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.