Rotherham secured Championship safety with a game to spare as Hakeem Odoffin's goal proved enough to beat 10-man Middlesbrough at New York Stadium.
Play-off-bound Boro lost full-back Anfernee Dijksteel to a straight red card in stoppage time of a scrappy first half for bringing down Jordan Hugill on the edge of the box.
And moments after the break Odoffin sparked jubilation among the home supporters when he lashed a 20-yard shot into the bottom corner of the net.
The result leaves Rotherham five points clear of the bottom three, while third-bottom Reading will now need Huddersfield to lose against Sheffield United on Thursday and then beat the Terriers themselves on the final day to avoid relegation.
It means the Millers will spend consecutive seasons in the same division for the first time since 2016-17 when a three-year stay in the Championship ended in relegation - with their past two second-tier campaigns lasting a single season.
Matt Taylor's side have won just six of 31 league matches since they last secured back-to-back victories in October, but have been helped by Reading's spiralling form and last month's six-point deduction.
For play-off bound Boro, a fourth defeat in their past six away games means they will finish the season in fourth place and face the fifth-placed side in the play-offs, while Luton are guaranteed third place.
Riley McGree almost gave Boro a seventh-minute lead when he dinked the ball over goalkeeper Viktor Johansson, but Richard Wood got back to hook it off the line.
Moments later, Jamie Lindsay blasted over when well placed at the other end, but the chances proved a false dawn as neither goalkeeper was troubled for the rest of a stop-start first half.
Rotherham lost both leading scorer Chiedozie Ogbene and Shane Ferguson to injury inside 40 minutes, but were boosted when referee Keith Stroud adjudged Dijksteel to be the last man in stopping Hugill's run, despite Boro appearing to have more cover.
It took the hosts just three minutes after the restart to make the man advantage count as Odoffin found space to unleash a strike which left goalkeeper Zac Steffen rooted to the spot.
The Millers had won just one of their previous nine matches, but seemed happy to keep what they had and defend their lead, inviting Boro pressure.
Michael Carrick's side, who have lost four of their past seven, bossed the final half-hour without causing too many problems.
However, there were sighs of relief when Tommy Smith sliced a glorious chance over from the corner of the six-yard box, and then in the final moments, Johansson made a scrambling stop as Lindsay diverted Marc Bola's cross towards his own net.
Line-ups
Rotherham
Formation 4-2-3-1
1Johansson
2Harding24Humphreys6Wood3Bramall
22Odoffin16Lindsay
11Ogbene18Rathbone17Ferguson
10Hugill
1Johansson2Harding24Humphreys6Wood3BramallBooked at 79mins22OdoffinBooked at 69minsSubstituted forHjeldeat 71'minutes16LindsayBooked at 29mins11OgbeneSubstituted forFosu-Henryat 19'minutes18RathboneSubstituted forKellyat 71'minutes17FergusonSubstituted forWilesat 40'minutes10HugillSubstitutes
7Fosu-Henry8Wiles12Kelly26Hemfrey29Hjelde30Kioso40QuinaMiddlesbrough
Formation 4-2-3-1
1Steffen
15Dijksteel17McNair26Lenihan27Bola
7Barlaser30Hackney
2Jones29Akpom8McGree
10Archer
1Steffen15DijksteelBooked at 45mins17McNair26Lenihan27Bola7Barlaser30HackneyBooked at 17minsSubstituted forMowattat 60'minutes2Jones29Akpom8McGreeSubstituted forCrooksat 80'minutes10ArcherSubstituted forSmithat 45'minutesSubstitutes
4Mowatt9Muniz Carvalho14Smith23Roberts25Crooks31Finch32BilongoReferee:Keith StroudAttendance:11,508Live Text
Match ends, Rotherham United 1, Middlesbrough 0.
Second Half ends, Rotherham United 1, Middlesbrough 0.
Corner, Middlesbrough. Conceded by Cohen Bramall.
Patrick McNair (Middlesbrough) wins a free kick in the defensive half.
Foul by Georgie Kelly (Rotherham United).
Foul by Isaiah Jones (Middlesbrough).
Cohen Bramall (Rotherham United) wins a free kick in the defensive half.
Corner, Middlesbrough. Conceded by Viktor Johansson.
Corner, Middlesbrough. Conceded by Georgie Kelly.
Chuba Akpom (Middlesbrough) wins a free kick in the attacking half.
Foul by Jamie Lindsay (Rotherham United).
Foul by Isaiah Jones (Middlesbrough).
Jamie Lindsay (Rotherham United) wins a free kick in the defensive half.
Delay over. They are ready to continue.
Delay in match because of an injury Jordan Hugill (Rotherham United).
Daniel Barlaser (Middlesbrough) wins a free kick in the attacking half.
Foul by Georgie Kelly (Rotherham United).
Attempt missed. Patrick McNair (Middlesbrough) header from the centre of the box is high and wide to the left. Assisted by Alex Mowatt with a cross following a corner.
Corner, Middlesbrough. Conceded by Cameron Humphreys.
Attempt blocked. Chuba Akpom (Middlesbrough) left footed shot from outside the box is blocked. Assisted by Alex Mowatt.