Jamal Lowe gave Pompey a 19th-minute lead when he fired a close-range effort into the roof of the net for his seventh goal in all competitions this season.
And the 23-year-old should have doubled his side’s advantage just before the half-hour mark when he was in on goal but Gillingham defender Luke O’Neill got back to make a last-ditch tackle.
The visitors struck back through half-time substitute Conor Wilkinson in the 48th minute after he took a touch to set himself up before curling his shot into the bottom corner.
The Gills then took the lead through Martin when his free-kick managed to drift past everyone and find the back of the net.
And Martin got his second and secured all three points for the away side with a spectacular goal in the 80th minute, the Gillingham captain curling the ball into the top corner from outside the area.
Rangers manager Steven Gerrard is weighing up a move for Liverpool full-back Jon Flanagan, reports claim.
Scottish champions Celtic are reportedly ready to offer full-back Calvin Miller a new deal before sending him out on loan.
Everton target Jack Wilshere has sparked a scramble for his signature after confirming he is leaving Arsenal this summer.
Tottenham's hopes of landing Wilfried Zaha have been hit by the news Crystal Palace have offered him a bumper new deal to stay.
Ryan Giggs says Gareth Bale would be the perfect fit for Manchester United but has doubts over whether he will leave Real Madrid.
Manchester City's attempts to sign Riyad Mahrez could be in doubt again as reports claim Leicester only want a straight cash deal.