Portsmouth scored twice in two second-half minutes as they put the departure of manager Steve Cotterill behind them.
Jacob Butterfield hit the inside of the post and saw his effort roll across the face of goal as Barnsley started well.
Pompey improved after the break and Jimmy McNulty cleared off the line from Erik Huseklepp.
David Norris opened the scoring after 61 minutes, volleying a low strike from the edge of the area, before Luke Varney pounced from close range.
The result ended Barnsley's seven-match unbeaten run but it could have been very different if the Tykes had translated their first-half performance into goals.
In addition to Butterfield's effort that struck the post, he also forced a save from Stephen Henderson with a fierce shot after eight minutes.
Bobby Hassell then weaved into the Pompey area before Ricardo Rocha made a great block to clear the danger.
Ricardo Vaz Te wasted a good chance, shooting over from a good position, before the home side started to threaten, with Greg Halford heading a Liam Lawrence corner wide.
Norris forced a save from Luke Steele, before Butterfield hit the post as an entertaining opening half finished goalless.
However, Pompey, with Stuart Gray and Guy Whittingham in temporary charge, took a grip on the game with their quickfire double and despite a fine save from Henderson, who tipped over a shot from Butterfield, the home team comfortably held on.