Crewe extended their unbeaten Sky Bet League Two streak to six matches as Gillingham were beaten 2-0 at the Mornflake Stadium.
Connor O’Riordan and Tom White scored in each half to climb up to third in the table, leapfrogging their opponents in the process.
The Gills went close when Ethan Coleman unleashed from 20 yards with the midfielder’s low drive beating Harvey Davies, but cannoning off the goalkeeper’s right-hand post. George Lapslie then undid some neat approach play for the visitors by hitting a wild effort over.
Crewe took the lead on the half-hour mark with O’Riordan meeting Zac Williams’ lofted cross at the far post with a powerful downward header which found the bottom corner.
Davies beat out Lapslie’s close-range shot after Macauley Bonne whipped the ball across the home box as Gillingham pushed for an equaliser. Within minutes Bonne wasted a better chance after Davies spilled a shot from Robbie McKenzie, only for the striker to stab the rebound wide.
After the restart, Jake Turner did well to block Courtney Baker-Richardson’s angled drive with a boot.
Dom Jefferies lifted a good chance over and Coleman thumped a free header wide with the goal at his mercy from a corner from Conor Mahoney.
But Crewe held firm and sealed victory when substitutes Aaron Rowe and White combined with the latter’s shot trickling over the line despite Turner getting a hand to the ball.