Four times these teams were in and out of the bottom three as Barnsley, who knew they were down if they lost, twice went ahead and Huddersfield, who could not breathe easily unless they at least claimed a draw, twice equalised.
When the home side drew level for the second time with eight minutes remaining through James Vaughan's deflected shot, Huddersfield were staying in the Championship and Barnsley were looking doomed.
Referee Andre Marriner, who will be in charge at the FA Cup final next weekend, signalled five minutes of added time. A lifeline for Barnsley? It might have been but, in the event, news of a goal for Crystal Palace against their rivals for relegation, Peterborough, in the last minute at Selhurst Park, persuaded both sets of players that the safest course of events was for neither team to score.
Provided Peterborough were not able to respond, a draw kept both sides up. Thus the game ended, somewhat farcically, with the Barnsley goalkeeper, Luke Steele, walking back and forth across his penalty area, ball at his feet, for fully two minutes, with players in red and in blue and white urging him to keep it. Marriner looked unsure what to do. If the thought occurred to him to book Steele for time-wasting, he did not act on it.
The rival supporters even suspended hostilities and joined each other in chanting: "Yorkshire, Yorkshire."
David Flitcroft, the Barnsley manager, said: "It was difficult for the players. We'd gone for the jugular, looking for a winning goal and, all of a sudden we were asking players to stop attacking. It was extraordinary."
Barnsley were second to bottom when Flitcroft succeeded Keith Hill as manager in January after winning two matches from three as caretaker. The side were five points from safety. "It is mission impossible achieved," he said.
Barnsley went ahead after 14 minutes when Chris O'Grady took advantage of a slip by Peter Clarke to steer a shot comfortably beyond Alex Smithies. Huddersfield trailed at half-time, by then fearing for their own future, but Jermaine Beckford scored eight minutes into the second half to put Barnsley back in the bottom three.
The positions were reversed when David Perkins crossed for Jason Scotland to restore the lead with only 16 minutes left, only for their joy to be punctured again by Vaughan's goal before the mood turned to mutual congratulation.
Dean Hoyle, Huddersfield's chairman, summed up the feeling in the ground neatly. "It's a great day for Yorkshire," he said.
Huddersfield (4-4-2): Smithies, Hunt, Clarke, Gerrard, Woods; Clayton, Norwood (Ward, 45), Gobern, Scannell (Novak, 80); Beckford, Vaughan.
Barnsley (4-4-2): Steele; O'Brien, Wiseman, Cranie, Kennedy; Dawson (Cywka, 84), Etuhu, Perkins, Mellis (Noble-Lazarus, 66); O'Grady, Dagnall (Scotland, 66).
Referee Andre Marriner.