Town fell behind on the ten-minute mark when Michael Smith rose well in the box to head home from 12 yards, before Bevis Mugabi equalised four minutes later with a header of his own.
Yeovil notched twice in quick succession midway through the first half as Tom Eaves and Izale McLeod – on his full debut – gave the hosts a 3-1 lead.
Pompey reduced the deficit to one thanks to Smith again after 37 minutes, but the Glovers’ two goal advantage was restored two minutes later thanks to Eaves’ second strike of the night.
Smith completed his hat-trick after the break but Yeovil absorbed the late Pompey pressure to claim a deserved victory at Huish Park.
Darren Way made three changes from the side that came away from Doncaster empty handed at the weekend, handing goalkeeper Jonny Maddison his Glovers debut as well as home and full debuts for McLeod and Ben Whitfield – who both arrived last week.
Kevin Dawson (rested) and Tahvon Campbell (ill) dropped out of the squad whilst Ryan Hedges missed the first of two matches due to international duty with Wales Under-21’s.
In a pulsating opening 45 minutes Town almost got off to a dream start when McLeod found himself through on goal after less than a minute, but the striker’s effort cannoned back off of the base of the post much to the relief of Liam O’Brien in the Pompey goal.
The experienced striker then saw a deflected effort hit the side-netting after eight minutes before the visitors took the lead against the run of play two minutes later.
Kai Naismith’s inch-perfect cross from the left was met by a towering Smith who gave Maddison no chance with a well-placed header.
Not deterred by falling behind Yeovil responded almost immediately and just four minutes later levelled the scores.
Matty Dolan’s fierce free-kick from 25 yards was glanced past a hapless O’Brien by Mugabi who notched his first goal in a Glovers shirt.
The onslaught from the home side continued after equalising and only a fine diving save denied Matt Butcher from 20 yards, whilst at the other end Maddison comfortably saved a Gareth Evans header from close range.
Town, though, looked likely to score with every attack and McLeod had the ball in the net only to be denied by the linesman’s flag, but Town weren’t to be denied for long.
With 22 minutes on the clock, Alex Lawless’ superb diagonal ball found the run of Eaves who demonstrated excellent composure to slot past O’Brien and take the lead.
An impressive half for the hosts got better four minutes later when McLeod finally found the goal his first half performance deserved.
The former Pompey striker weaved his way into the box before exchanging passes with Otis Khan and nonchalantly lifting the ball over O’Brien to find the back of the net on his home debut, in what will prove to be one of the best goals scored at Huish Park this season.
In a game full of goals Paul Cook’s side got one back ten minutes later when Smith found space in the box to fire past Maddison, before Eaves helped himself to a second of the night with a perfectly placed shot from the edge of the box after a strong run from virtually the halfway line.
Despite the 15-minute break Darren Way’s side continued to threaten the Portsmouth goal and just three minutes after the restart Eaves almost completed his hat-trick with an effort from the edge of the box flying just over the bar.
It was the visitors who were next on the scoresheet however as Smith completed his hat-trick with a second header of the evening, to make the score 4-3 after 54 minutes.
Darren Way’s side continued to threaten Portsmouth’s goal and Eaves was again denied a hat-trick just past the hour mark when O’Brien saved a fierce effort with his legs.
After a relentless 65 minutes the tempo of the match dropped slightly with both sides introducing fresh legs, although Maddison was forced to save a Linganzi effort on his goal-line inside the last 10 minutes.
Yeovil were tested defensively in the closing stages but Darren Way’s side saw out the late Pompey pressure to get off to a winning start in Southern Group A of the Checkatrade Trophy.
Yeovil Town: Krysiak; Shephard, Butcher, Smith, Mugabi; Whitfield (Lea 75’), Lawless, Dolan; McLeod, Eaves, Khan (Copp 89’).
Bookings: Shephard 45’, Khan 60’.
Subs not used: Krysiak, Sowunmi, Bassett.
Portsmouth: O’Brien; May, Barton, Clarke (Davies 61’), Naismith; Linganzi, Close; Evans, Bennett, Tollitt (Chaplin 55’); Smith (Hunt 73’).
Bookings: Barton 4’, Close 62’.
Subs not used: Hall.