The promotion hopefuls left it late in the game but sealed all three points with a 2-0 win.
Loanee Eddie Nketiah came off the bench to break the deadlock, while Mateusz Klich made the game safe for Leeds.
Both teams had chances early in the game, with the action being end to end.
But it was not until the calmness of Nketiah coming off the sub's bench that Leeds got their breakthrough.
Barnsley may feel hard done by, given their excellent performance in the game.
They had picked a very young side for the clash, with all their players aged 24 or less.