The hosts applied early pressure but Harry Medway's seventh-minute cross into the box was not met by any ofÂ his team-mates.
Against the run of play, Totton took the lead.
Stuart MottÂ struck the ball from 30 yards out and found the top corner of the net.Â
The goal gave the visitors a boost, with Craig Feeney going close.
Predicted Portsmouth XI v Cheltenham: changes expected to side that beat Cardiff so handsomely - but attacking duo could keep places and defender set to return
Portsmouth transfer news: Blues youngsters attracting interest but Danny Cowley has no desire to cash in just yet
League One latest: Oxford land former Pompey striker target from Swansea as Sheffield Wednesday bemoan exciting duo's move to Brentford and former Peterborough boss criticises club
Portsmouth boss Danny Cowley hails Spurs loanee Dane Scarlett as move already shows signs of putting Miguel Azeez's short stint from Arsenal in shade
Portsmouth boss Danny Cowley makes transfer admission as former Luton and Millwall midfielder edges closer to Fratton Park exit
Keeper Adam Siviter was called into action on 21 minutes to deny Patrick Suraci.
A minute later Gosport did equalise thanks to Ryan Pennery who fired his shot from inside the box.
The striker then had a chance to give his side the lead but hit the side-netting.
Moments later ,Craig McAllister hit the crossbar with his headed effort.
On 38 minutes, Borough goalkeeper Patrick O'Flaherty stopped Justin Bennett's goal-bound shot.
Just before the break, Totton re-took the lead.
Callum Chugg headed into the net from Charlie Gunson's cross.
Gosport continued to dominate possession at the start of the second half.
In the 53rd-minute Pennery ran into the box but his shot was off target.Â
Then Medway had a chance but he put his effort wide.
The home side made two substitutes, bringing on David Jerrard forÂ Joe Lea and Matt Tubbs for McAllister.Â
On 72 minutes, Feeney had a chance to extend Totton's lead but it was saved.
With the game coming to a close, Borough put the ball into the box and a goalmouth scramble saw it cleared by the visitors.Â