Kieffer Moore claimed a hat-trick on a memorable night at Spotland.
Daniel Stendel’s side were excellent value for their two-goal half-time advantage.
They almost struck after just three minutes when Moore thumped a header against the crossbar.
Midfielder Alex Mowatt then curled a shot against the outside of a post just before the half-hour mark. Rochdale’s brief response almost brought a shock goal when Matty Done headed Ian Henderson’s cross over the top.
The visitors’ dominance was rewarded after 35 minutes when Brad Potts coolly headed home Moore’s outswinging cross.
Six minutes later it was 2-0 when Moore headed home a similarly impressive cross from Dani Pinillos.
Shortly before the break Mamadou Thiam was denied by a frantic goal-line clearance from an overworked Rochdale defence.
Barnsley extended their lead three minutes into the second half. Moore struck again, turning half-time sub Joe Rafferty inside out before burying a sweet angled drive past a helpless Josh Lillis.
Mowatt curled a free-kick inches wide on the hour mark as the visitors remained firmly on top.
They made it four in the 68th minute when Moore evaded two weak Rochdale challenges before slotting in his hat-trick goal.
Rochdale: Lillis (Norman, 61), Delaney, McGahey, McNulty (Rafferty, 46), Ntlhe, M J Williams, Perkins, Cannon (J Williams, 79), Done, Henderson, Andrew. Unused substitutes: Camps, Rathbone, Wilbraham, Inman.
Barnsley: Davies, Pinillos, Lindsay, Cavare (J Williams, 78), Pinnock, Potts, Dougall (McGeehan, 65), Mowatt, Thiam (Moncur, 65), Bradshaw, Moore. Unused substitutes: Walton, Jackson, B Williams, Adeboyejo.
Referee: Michael Salisbury.