Chris McCready's 21st minute own goal put the home side in front, before Andrew Crofts secured the points with a well-directed header ten minutes later.
Tranmere had suffered a blow moments before kick-off, losing central defender Ian Goodison after he aggravated an injury in the warm-up.
Replacement Chris Tremarco slotted in at left-back, allowing Shane Sherriff to cover Goodison's position.
The loss of Goodison appeared to affect Rovers and Gillingham took full advantage, taking the lead in bizarre fashion on 21 minutes, after a bright opening to the game. Danny Jackman's low corner bounced off Rovers defender McCready past the helpless Joe Hart in the Tranmere goal.
Tranmere responded, but after Sherriff wasted a decent chance to draw Rovers level, Gillingham added to their woes by immediately doubling their advantage in the 30th minute. Mark Bentley was allowed time to deliver a precise cross that the unmarked Crofts powerfully headed home.
Gillingham continued to press, but in the 34th minute Gareth Taylor missed a golden opportunity to reduce the deficit, when he headed tamely at Gills goalkeeper Romain Larrieu, in the false assumption that he was offside.
Tranmere surged forward after the break and came desperately close to an equaliser, only to be denied by the woodwork on three occasions. In the 62 minute Chris Shuker played a neat one-two with Chris Greenacre, but fired his shot against the underside of the bar.
Six minutes later Greenacre hit the post from a Shuker cross, before Steve Davies brought a smart stop out of Larrieu from the rebound.
And after Jarvis blazed over following a mazy run, Shuker again picked out a runner with a cross, only for John Mullin to find the post with his header.
Rovers continued to press through the impressive Shuker, but gaps began to emerge in their defence that Matt Jarvis began to exploit. On numerous occasions the winger was released down the left, but the youngster's finishing lacked composure.
Despite the Rovers pressure, Gillingham managed to see out the remainder of the game without any further scares to record a much-needed win.