Tykes undone by Swans in cup
The Championship side went ahead just before the half-hour mark through a fierce drive from their top scorer Ricardo Vaz Te, only for the Swans to equalise within a minute thanks to Angel Rangel's finish.
A great strike by Danny Graham moments after the interval put the Swans in front before Nathan Dyer made it 3-1 in the 54th minute, and after Vaz Te had pulled one back in the 65th, Graham scored again late on to seal victory for the Premier League team.
Swansea summer signing Gerhard Tremmel replaced Michel Vorm in goal to make his debut, while defender Garry Monk came in for Steven Caulker in the only other change to the first XI from the 2-0 win at Aston Villa on Monday. Midfielder Gylfi Sigurdsson, whose arrival on loan from Hoffenheim had been confirmed earlier in the week, was among the substitutes.
For the hosts, midfielder Danny Drinkwater made his comeback from injury a day after extending his loan from Manchester United with defender Scott Wiseman dropping to the bench in the only adjustment from the 2-0 defeat at Doncaster.
Swans midfielder Kemy Agustien made the game's first attempt on goal in the 12th minute, firing an effort from outside the box which brought a diving save out of Luke Steele.
Two minutes later Steele was called into action again, doing well to deny Wayne Routledge after the winger had found himself in on goal.
At the other end, the ball dropped on the edge of the area to Jay McEveley, who cracked a shot over the bar.
Drinkwater went closer with a strike that was just too high, and having gained in confidence, Barnsley then broke the deadlock, Vaz Te breaking forward in the 29th minute to send a shot dipping over Tremmel.
The lead lasted only a few seconds, though, before Rangel was allowed the space to turn and prod an equaliser past Steele.
Swansea then turned up the pressure, with Dyer in particular looking dangerous, but some important interventions ensured the visitors could not add another goal before the break.
The Welsh side picked up where they had left off at the start of the second half and less than a minute in, they made it 2-1, Danny Graham unleashing a cracking effort from distance that Steele had little chance of stopping.
Vaz Te struck wide, but Swansea kept coming and after spooning one opportunity over the bar, Dyer swiftly made amends by converting Routledge's cross to extend the advantage.
The tie looked settled, but Barnsley were not done and having sent another attempt off target, Vaz Te then netted his second of the afternoon, getting on the end of a free-kick with a tap-in at the far post.
The Tykes continued to press, with substitute Reuben Noble-Lazarus hitting a shot wide.
Stephen Foster tried to tee up another substitute, Andy Gray, in front of goal, but Rangel nipped in to clear the danger.
It was spirited stuff from Barnsley, but they could not find a leveller and with a minute of normal time remaining, Graham wrapped up Swansea's win by slotting in from close range.