Gary Taylor-Fletcher grabbed a late winner to take Peter Jackson's Huddersfield side halfway to Cardiff after a thrilling Yorkshire derby.
Andy Booth crossed from the left five minutes from the end and as keeper Nick Colgan collided with Paul Heckingbottom, the Town winger rammed home a low shot.
But either side could have edged in front after carving out chance after chance in a nailbiting tussle that had the brought a standing ovation from the 16,000 crowd.
Huddersfield saw a string of chances go begging in the first half as manager Jackson looked to give the Terriers their second promotion in three seasons via the play-offs.
Taylor-Fletcher should have put the visitors in the driving seat in the second minute but headed over the top from point-blank range.
Six minutes later David Graham made a surging run and slipped a neat pass to Danny Schofield, but his angled shot hit the post and when Graham hit a dipping volley it went over.
A Schofield corner found defender Martin McIntosh but he headed over and another Graham snapshot was high.
Andy Ritchie's side, with only two wins in their last 12, were handed a chance after 30 minutes, but Brian Howard's 25-yard free-kick cannoned off the Town wall and Chris Shuker screwed his follow-up wide.
It sparked the home side into life and Daniel Nardiello - whose late penalty at Walsall sealed Barnsley's play-off spot - made a powerful run but his shot was deflected wide.
And seconds before the break Martin Devaney pounced on a loose ball but his dipping effort from 20 yards grazed the bar and skidded over.
After the break Barnsley turned the tables and Nardiello fired across the face of goal before Shuker's low drive was held by Paul Rachubka.
Skipper Paul Reid, back from suspension almost had a dream return but he squeezed his shot just wide after Howard's free-kick.
A wonder save from Rachubka denied Nardiello when the striker burst through to produce an astute lob, with his former Manchester United youth team colleague tipping over.
Barnsley keeper Colgan matched the save with a fabulous reflex stop to block a McIntosh header ten minutes from the end.