Derby ended a run of eight games without a win against Barnsley to secure their first back-to-back victories in 24 league matches.
The Tykes looked on course to extend their unbeaten run against the Rams until James O'Connor's close-range finish in the 69th minute.
Substitute Nathan Tyson settled the game with a superb 20-yard drive.
Derby move up to ninth in the table but Barnsley's third straight defeat leaves them a place above the bottom three.
With just 15 goals from 15 league games this season, it is clear to see where the Tykes' problem lies.
While they were able to hold the Rams at bay for a large portion of the game, Keith Hill's side did little to really test home keeper Adam Legzdins.
The closest they came to finding the net was a smart shot from former Rams midfielder Tomasz Cywka that Legzdins turned over the top and a Chris Dagnall drive blocked by the keeper.
Derby created more but were often found wanting when it came to finishing.
In the first half, Conor Sammon produced a neat turn in the area but fired over from 10 yards before both Will Hughes and Jeff Hendrick drew neat saves from visiting goalkeeper Luke Steele.
County were angered when their penalty appeals for what they perceived as a foul on Craig Bryson in the box were waved away in the 55th minute.
But 14 minutes later, O'Connor finally made the breakthrough when he latched onto Richard Keogh's header to fire home and Tyson settled the game with his late strike.
Derby manager Nigel Clough says Nathan Tyson will have to wait for a starting chance up front despite scoring the Rams' second goal: "It was a lovely way to finish and meant we were not sweating going into the last few minutes.
"Everyone has to play their part and it's absolutely vital that even when they come off the bench, they contribute.
"He's pressing for a start but the front two have played so well that he understands it's difficult for him to get in so all he can do is keep doing what he did tonight, put a goal in when he comes on and be a nuisance.
"You never know we might get an injury in training this week and then he's ready to come in."
Barnsley boss Keith Hill: "We give the opposition to much encouragement with silly free-kicks but it's marginal whether you win, lose or draw depending on the decisions players make.
"I set a framework out but the players have to make decisions within that.
"The players have given me everything they possibly could but when we create chances we've got to convert or at least hit the target and when we defend free-kicks we've got to make sure we clear them.
"The players have got to make better decisions on behalf of me and I can't play that game for them. We are looking for them to progress by making less mistakes and to be more assertive in front of goal."