Barnsley defender Brian O'Callaghan headed the crucial goal that should keep the Tykes in Division Two but send the Stags into Division Three.
O'Callaghan nodded in a 31st minute corner to clinch Barnsley's first win in seven games and settle a poor relegation dogfight.
Mansfield, beaten in five consecutive matches including three home games against relegation rivals rarely threatened an equaliser in a game they had to win.
Iyseden Christie glanced a second-half header narrowly wide, Liam Lawrence's point blank effort was scrambled off the line and substitute Colin Larkin rolled a shot across the face of goal and wide.
Barnsley, who comfortably soaked up the pressure, should have secured victory five minutes from time when Mike Sheron rounded the keeper before Lee Williamson cleared his shot off the line.
Afterwards delighted Barnsley boss Glyn Hodges said: "It's a relief to have got the three points after those defeats.
"We deserved the victory but we're not out of the mire yet." Defiant Mansfield assistant manager John Gannon refused to concede defeat in the battle against relegation, claiming: "We're not down yet and Keith Curle and myself won't give anything up until it is impossible." Curle had rung the changes in a bid to end Mansfield's disastrous run of results. He gave a debut to 17-year-old defender Alex Baptiste who went on to win man-of-the-match after mastering the threat of both Sheron and the pacy Kevin Betsy.
Barnsley weathered Mansfield's early pressure when Craig Disley and Christie both fired over and then looked dangerous on the breakaway.
Sheron blazed over from 12 yards and Mitch Ward's piledriver was deflected into the side netting.
But Mansfield failed to heed the warning and conceded the vital goal from the last of three successive corners. O'Callaghan shrugged off his marker and rose highest to head in Kevin Donovan's flag kick to clinch the all-important three points.