Steve Cooper’s side were far from their best, particularly in a mediocre first half that they finished in front after Ben Cabango’s stoppage-time header from a Connor Roberts throw.
They were two goals up 10 minutes into the second period when a comical defensive mix-up at the back from Barnsley allowed Jamal Lowe to score his seventh goal in seven matches.
That was enough to see Swansea, who have conceded just one goal in an unbeaten run now stretching to six matches, move clear of third-placed Bournemouth and keep pace with leaders Norwich City, while the hosts missed the chance to move up to seventh.
Story of the match
Even though they finished it ahead, Swansea failed to settle into any sort of rhythm in a poor first half, with their attempts to replicate Barnsley’s direct approach bringing few positive results.
Instead Valerien Ismael’s side did most of the threatening, and particularly the recalled forward Victor Adeboyejo, who fired one snap-shot over before a saved near-post drive resulted in a corner from which Conor Chaplin smacked a volley at goal which Andre Ayew blocked.
Swansea were offering very little in attack, Marc Guehi failing to steer one awkward header on target, and it looked like it would be goalless at the interval when Callum Styles put a tame effort straight at visiting goalkeeper Freddie Woodman.
But out of nowhere, a goal came in the one minute of added time. Roberts launched a throw into the middle of the box and Cabango was on hand to glance a perfect header into the far corner for an unmerited half-time lead.
Despite holding the advantage, they came out in the second half with more drive and vigour, with Roberts close to turning scorer when he struck a brilliant volley from outside the area and was unlucky to see it fall just wide.
But Swansea would not have to wait much longer before their lead was doubled, thanks to the remarkable generosity of Barnsley defenders Mads Andersen and Michal Helik. The pair clashed into each other in comical fashion but it was no laughing matter for the Reds, as in-form Lowe was given a free run on goal to beat Walton.
Those goals would prove enough, not that they didn’t have to work to quash any hopes of a comeback. Woodman in particular stepped up to the plate when required, making a stunning save to tip Callum Brittain’s 30-yard piledriver over his crossbar.
Team for all seasons
Impregnable defence isn’t the first quality that comes to mind recalling Swansea sides of the past, but under Cooper the tough stuff has been given just as much focus as the technical work.
They have conceded a brilliant tally of just 13 goals in their 24 league matches this season to hold by far the best record in the division, and this was an eighth clean sheet in their past 10 in all competitions.
That they are reaching new heights in the depths of a Championship winter is a hugely positive sign in their bid for a Premier League return, and on a cold and windy night in Barnsley they proved up to the job of dealing with an immensely direct and intense side, with a pair of 20-year-olds shining in Cabango and Guehi.
They also showed their willingness to tough it out and adapt to different situations by launching the most un-Swansea of weapons in Roberts’ long throw, which caused danger and brought the opening goal.
Mistakes costly again
In contrast to the impregnable victors, Barnsley have not kept a clean sheet in their past 12 matches in the Championship, and not for the first time they only had themselves to blame.
They might regret not better dealing with the throw for the first goal, as Cabango emerged on top from a pack of jumping heads, but it was the second that really had them in despair at themselves.
Andersen and Helik, both strong performers at the back this season, had a horror moment as they both went for the same ball and collided with each other, putting Lowe through on goal.
The way that Barnsley play leads to a huge number of turnovers and transitions, which invites a lot of pressure on their defence. The back five tend lead the way in the whole division on blocks, interceptions, tackles and the like, but the volume of work inevitably leads to the odd mistake, and that’s the risky game the Reds choose to play.
Man of the match: Connor Roberts
The Swans right wing-back was their most consistent threat, and a player who has improved markedly under Cooper put in an accomplished display which included an assist for Cabango’s opener.