More on KentOnline
Bradley Dack celebrated signing his new contract at Gills with a priceless goal on Friday.
Dack, who signed a new deal this week to remain at the club until 2018, came off the bench and volleyed home with 78 minutes gone.
The Gills added a second through Cody McDonald in stoppage time.
It was a deserved victory for the Gills after dominating the match at Priestfield for long periods. Victory took the Gills’ point tally to 51 and moved them well clear of the League 1 relegation dog-fight.
Boss Peter Taylor made three changes to the side which had performed so badly the week before, at Leyton Orient.
Leon Legge returned from injury to play centre-back, while Adebayo Akinfenwa lined up alongside Cody McDonald in attack.
It was a game the Gills had to avoid losing. A win would make them all-but safe but defeat would leave them right in the middle of the League 1 relegation scrap.
The Gills reached the break without scoring despite numerous chances.
Akinfenwa had the best of those, in first-half stoppage time, with a lob over keeper Owain Fon Williams that landed agonisingly wide.
The same player headed over a Jake Hessenthaler corner moments earlier as the Gills put plenty of dangerous balls into the Tranmere box.
Charlie Lee, playing as one of the wingers in a 4-4-2 formation, had a lively half. He had an early chance blocked and put another effort wide, after skipping past right-back Matthew Pennington.
Lee also laid a chance on a plate for McDonald but the striker was denied by keeper Fon Williams.
Tranmere rarely threatened in the opening half and Stuart Nelson was untroubled. The closest they got was a long-range effort from Jean-Louis Akpa Akpro, who shot into the side-netting.
It took the Gills a while to warm themselves up in the second half and on the hour keeper Fon Williams made a good save from McDonald before Myles Weston fired a chance over the bar seconds later.
Jason Koumas forced Nelson into his first save of the match on 64 minutes, with a shot from distance. Moments later he was called on again, to save from Akpa Akpro.
Tranmere continued to threaten, with Jake Cassidy firing a long-range effort narrowly wide.
With 20 minutes left Danny Kedwell came on, making his first appearance since January.
Fon Williams continued to thwart the Gills, with the visiting keeper again saving from McDonald.
With 12 minutes left the Gills took the lead as Joe Martin’s cross fell to Dack and he volleyed home to finally beat the Tranmere keeper.
The Gills sealed it in stoppage time when McDonald slid the ball home after Fon Williams was out of his goal, having gone forward for a corner.
Gillingham: Nelson, Hewitt, Martin, Legge, Barrett, Gregory, Hessenthaler, Lee (Dack 66mins), Weston, Akinfenwa (Kedwell 70mins), McDonald. Subs not used: Baxter, Linganzi, Whelpdale, Harriman, Fagan.
Tranmere: Fon Williams, Taylor, Goodison (Holmes 28mins), Cassidy, Power, Brown, Koumas (Stockton 85mins), Ridehalgh, Akpa Akpro, Pennington, Lowe (Arthurworrey 90mins). Subs not used: Rowe, Kirby, Boland, Mooney.
Attendance: 7,343 (193 away)