Match ends, Middlesbrough 3, Barnsley 1.
Barnsley were relegated from the Championship as a Lee Tomlin double earned Middlesbrough a comeback win.
Only victory would have given the Tykes any prospect of staying up and those hopes were lifted when they led against the run of play through Jean-Yves M'voto's hooked finish after the break.
But Boro levelled inside a minute, as Tomlin pounced for his first.
And as Barnsley chased the win, Danny Graham's close-range strike and another Tomlin strike sealed their fate.
The Tykes' chances of avoiding the drop and extending their eight-season stay in the second tier of English football, already appeared slim before the trip to Teesside.
But three wins from their last five away games had at least provided some optimism against a side who were already safe and could not make the play-offs.
They duly produced a gutsy first-half display, though they struggled to repel constant home pressure and the only decent chance of their own came early on when Marcus Pedersen's deflected cross forced goalkeeper Dimi Konstantopoulos into a full-length save.
After that Boro created numerous openings.
The lively Adam Reach had three attempts on goal, Tomlin went close on two occasions and Albert Adomoah also shot straight at goalkeeper Luke Steele from close range.
And in the closing stages of the first period, Reach had a 20-yard effort parried, Danny Butterfield was denied by a fine save from Steele and Daniel Ayala's stabbed effort was also kept out by the keeper.
Boro again started brightly after the break but Barnsley led on 53 minutes when Martin Cranie's corner was not properly cleared and M'voto scored with a clever finish that went inside the far post.
The hosts replied instantly, Tomlin pouncing on a loose ball and smashing home a low 20-yard shot.
As the game opened up Nick Proschwitz fired over for Barnsley when well placed.
But with the Tykes desperately chasing a win that would have kept them alive until the final day of the season, Boro went ahead. Adomah's shot was blocked and Graham fired in the rebound from eight yards.
And Boro wrapped up the points three minutes into injury time as Tomlin finished neatly for the second time after playing a one-two with Adomah.
Middlesbrough manager Aitor Karanka:
"I said to the players that this was a very important game. I told them it was not the last game of this season, it was the first game of next season.
"They have to work now for the future. We did well today but we can always improve and get better. It was not brilliant but we won and that was what counts.
"My players only woke up after Barnsley had scored. For the first 25 minutes I was disappointed because we had started so slowly, but after that we played with more intensity and created chances.
"If you do that the goals will come and for that I am happy."
Barnsley manager Danny Wilson told BBC Radio Sheffield:
"A lot of people would have written us off a long time ago so it's testament that we took it this far.
"The dressing room is as a flat as you could get it of course. It's a sad day for everyone connected with the club. It's going to take a little bit of getting over but you have to very quickly.
"We never really got going today. We were a little timid in our attacks in the first-half, but in the second-half we started to believe a little bit after we scored.
"Sadly we conceded a goal straight away from a mistake and that cost us today."
- 22GibsonBooked at 71mins
- 39WoodgateSubstituted forAyalaat 41'minutes
- 25OmeruoSubstituted forHinesat 67'minutes
- 6ButterfieldSubstituted forChalobahat 60'minutesBooked at 89mins
- 14LawrenceSubstituted forO'Brienat 60'minutes
- 27McLaughlinSubstituted forRoseat 81'minutes
- 20PedersenSubstituted forProschwitzat 60'minutes
- Darren Drysdale
- Shots on Target
Second Half ends, Middlesbrough 3, Barnsley 1.
Foul by Lee Tomlin (Middlesbrough).
Thomas Kennedy (Barnsley) wins a free kick in the defensive half.
Corner, Middlesbrough. Conceded by Thomas Kennedy.
Attempt saved. Nick Proschwitz (Barnsley) right footed shot from outside the box is saved in the bottom left corner. Assisted by Danny Rose.
Goal! Middlesbrough 3, Barnsley 1. Lee Tomlin (Middlesbrough) right footed shot from the centre of the box to the bottom left corner. Assisted by Albert Adomah.
Goal! Middlesbrough 2, Barnsley 1. Danny Graham (Middlesbrough) right footed shot from the centre of the box to the bottom right corner.
Attempt saved. Albert Adomah (Middlesbrough) left footed shot from the centre of the box is saved in the bottom left corner. Assisted by Nathaniel Chalobah.
Nathaniel Chalobah (Middlesbrough) is shown the yellow card.
Lee Tomlin (Middlesbrough) wins a free kick in the defensive half.
Foul by Thomas Kennedy (Barnsley).
Foul by Sebastian Hines (Middlesbrough).
Chris O'Grady (Barnsley) wins a free kick in the attacking half.
Attempt missed. Nick Proschwitz (Barnsley) header from the centre of the box misses to the left. Assisted by Stephen Dawson.
Attempt saved. Lee Tomlin (Middlesbrough) right footed shot from the centre of the box is saved in the bottom right corner. Assisted by Nathaniel Chalobah.
Attempt missed. Dale Jennings (Barnsley) right footed shot from outside the box misses to the right. Assisted by Nick Proschwitz.
Ben Gibson (Middlesbrough) wins a free kick on the left wing.
Foul by Danny Rose (Barnsley).
Substitution, Barnsley. Danny Rose replaces Ryan McLaughlin.