Derby were booed off at half-time and were fortunate to still be in the game when Barnes turned the match on its head with two exceptional goals from the edge of the penalty area.
A fifth defeat in six matches was tough on the South Yorkshire club who would surely have won this match with better finishing.
Marc Richards missed a great chance early in the second half and his team paid a high price for that when Derby's pressure finally brought some reward.
But until Barnes smashed in a left-foot strike that probably caught Nick Colgan unsighted, Derby were far from convincing.
Too many players were well below-par and at the back they looked an accident waiting to happen.
If Barnsley's finishing had matched the keenness and sharpness of their approach play, the visitors would have had the game sewn up long before Barnes gave his team a lifeline.
As it was, Bobby Hassell's 13th-minute volley after Stephen Bywater had flapped at a Michael McIndoe corner was all they had to show for an impressive 45 minutes' work.
Martin Devaney was unlucky not to add a second straight from the restart and Richards saw a low shot turned around a post by Bywater after a dreadful mix-up between Dean Leacock and Darren Moore.
Richards should have added a second in the 53rd minute when Devaney cut out Seth Johnson's cross-field pass and played an inviting ball across the six-yard area but Richards put the chance wide.
Johnson became stronger after that mistake and it was his prompting from midfield that started to give Derby a foothold in the match.
But it still needed something special to peg Barnsley back and Barnes provided it in the 72nd minute when a free-kick was only half-cleared and his left-foot shot crept through a crowd of players and inside a post.
Four minutes later and lightning struck again when another cross was only cleared to the edge of the area and Barnes smashed a right-foot shot into the roof of the net.
Barnsley thought they'd salvaged a point in the final minutes when Bywater could not hold a McIndoe shot but substitute Paul Hayes had strayed offside before he put the rebound in.