Adebayo Akinfenwa's first goals since August helped Gillingham beat 10-man Tranmere, who failed to ease their relegation fears.
Akinfenwa put Gills ahead with a fierce shot from inside the box.
Tranmere's Jim McNulty was sent off 10 minutes after the break for bringing down Cody McDonald when clean through.
Akinfenwa's close-range second doubled the lead before Ryan Lowe rounded Stuart Nelson to tap into an empty net to give Tranmere late hope.
It was Gillingham's first win in four games, while Tranmere sit two points above the bottom four.
VIEWS FROM THE DRESSING ROOM
Tranmere manager Ronnie Moore told BBC Radio Merseyside:
"It was a tough night. If you put their two centre-backs in our team, we win the game. We can't defend. If you can't defend, you don't win games.
"We've got two guys who think they're footballers. They're centre-backs and their living is to head it and kick it.
"We always looked like we were going to get a goal, but every time they went forward, they looked they were going to score. That's the way it's been for the last few weeks."
Gillingham manager Peter Taylor told BBC Radio Kent:
"We made awfully hard work of it. The effort was fantastic. We conceded a bad goal to make it a nervy finish and we have to do better than that.
"But overall I've got to be pleased with three points. We've just got to take our chances a bit more.
"I thought last Saturday there was a good feeling. The supporters played a massive part and gave us the confidence to come here and put on a massive performance."
Tranmere Rovers 01 Williams 02 Holmes 23 Ridehalgh 22 Koumas 04 Taylor 20 McNulty Dismissed 25 Peterson (Robinson - 72' Booked ) 08 Wallace 26 Akpa Akpro (Stockton - 64' ) 09 Lowe 15 Kirby (Horwood - 57' ) Substitutes 03 Horwood 10 Robinson 14 Atkinson 16 Stockton 17 Power 31 Otsemobor 33 Mooney Gillingham 01 Nelson Booked 23 Harriman 03 Martin 31 Hessenthaler 26 Barrett 06 Legge 15 Dack Booked 12 Gregory 10 McDonald 08 Akinfenwa (Lee - 72' ) 11 Weston (German - 22' ) Substitutes 05 Davies 16 German 18 Lee 21 Howard 27 Fagan 28 Daniels 30 Hare
Ref: Robert Lewis