The Tykes had goalkeeper Adam Davies to thank for keeping out an early Ivan Toney penalty, with former Posh midfielder George Moncur scoring a minute later for the visitors before Brad Potts (twice) and Jacob Brown struck to move Barnsley within two points of their opponents.
Things might have been different when Posh were awarded a penalty in the 13th minute for contact on Joe Ward by Dimitri Cavare.
Toney’s spot kick was well saved low down to his left by Davies, and Posh were punished a minute later when they failed to clear and the ball came to Moncur to score from close range.
Potts then rifled in a 25-yard free-kick touched in his direction in first-half stoppage time, with the attacking midfielder finding the bottom corner from 20 yards after 59 minutes.
Substitute Brown scored in the same corner in the 92nd minute to round off the win.