The hosts twice led during an action-packed first half, but Forest fought back to make it back-to-back wins in the Championship for the first time since August.
Forest arrived at Oakwell looking for their first clean sheet at the ground since 1952, but it took only five minutes for Barnsley to ensure that the wait would go on as Sam Winnall nodded home from close range after being picked out by James Bree.
Forest immediately went up the other end and levelled things up, though, with Lansbury laying a free kick off to Pajtim Kasami before getting the ball back and placing an inch-perfect finish into the bottom corner from range.
Parity lasted less than two minutes for the visitors, however, with Barnsley restoring their lead moments later when Marley Watkins beat the offside trap to latch on to Conor Hourihane's chipped ball over the top before chesting it down and sweeping his finish past the keeper.
The end-to-end start to the match continued and Forest were level again midway through the opening period when Apostolos Vellios smuggled the ball home from close range despite mis-hitting his finish.
Barnsley began to gain a measure of control over proceedings as the half wore on, though, with Winnall and Hammill both coming close on a couple of occasions for the home side.
However, it was Forest who would go into the break ahead as Lansbury doubled his tally for the evening in first-half stoppage time, steering a diving header into the bottom corner at the end of a devastating counter-attack.
Barnsley continued to pose a threat at the start of the season half as they went in search of an equaliser, but once again Winnall failed to make the most of decent chances before Josh Scowen also fired over the crossbar.
Forest have dropped more points from winning positions than any other side in the Championship this season, so their fourth goal would have come as a huge relief as Ben Osborn glanced a header home to give the visitors a valuable two-goal cushion.
Any hopes of a home comeback grew even fainter with just over 20 minutes remaining when Watkins was shown a straight red card following a clash with Thomas Lam in which he appeared to lead with his elbow before making a stamping motion towards the Forest player while he was on the floor.
Openings continued to arrive at both ends of the field, with Lam having two long-range efforts and Winnall once again failing to hit the target with a header, but Forest put the game to bed once and for all with 10 minutes remaining.
Matty Cash cut inside from the left flank before being brought down by Scowen just inside the penalty area, and Lansbury stepped up to send the keeper the wrong way and complete his hat-trick.
There was almost a late consolation for Barnsley in stoppage time when Scowen diverted a header towards goal from close range, but Vladimir Stojkovic reacted well to deny the midfielder.
Forest were able to hold on to their three-goal advantage until the final whistle, climbing up to 17th place as a result of the win and moving six points clear of the relegation zone.
Barnsley, meanwhile, miss the chance to move into the top half of the table and have now won just one of their last 11 league outings, including a seven-game winless run at home.