Ten-man Newcastle guaranteed Premier League survival as they came from behind to defeat QPR at Loftus Road.
Loic Remy's early spot-kick put Rangers ahead but Hatem Ben Arfa soon levelled with an equally controversial penalty.
A calamitous defensive mix-up then allowed Yoan Gouffran an easy finish to put the Magpies ahead.
And the visitors held on for a precious win despite losing goalkeeper Rob Elliot to a second yellow card when he handled outside the penalty area.
Ben Arfa's wait
Hatem Ben Arfa's goal was his first since the injury-hit forward scored against Fulham on 10 December.
Having reached 41 points, Alan Pardew's team cannot be caught by both Aston Villa and Wigan, who meet on the final day next Sunday.
Defender Jose Bosingwa, recalled after coming under criticism for smiling as he retreated down the tunnel following
and Stephane Mbia,
fined by the club after he suggested on Twitter that he wanted to return to Marseille,
were both booed by their own supporters and substituted at half-time.
Given what was at stake, it was perhaps no surprise Newcastle began nervously, and within 11 minutes they had got off to the worst possible start.
Referee Lee Probert awarded a penalty despite Mathieu Debuchy's tug on Junior Hoilett's shirt taking place outside the area before the winger went to ground inside the box.
Yohan Cabaye was booked for dissent as Newcastle's frustration spilled over, but Remy was coolness personified as he sent Elliot the wrong way, calmly stroking the ball into the bottom-left corner.
But the home side's lead lasted just seven minutes as Probert penalised Bosingwa for pulling on Ben Arfa's shirt.
"Newcastle are safe. It was gritty, it was nervy, it was controversial. Mike Ashley can smile and think about re-planning and I'm sure Alan Pardew will be central to those plans."
Ben Arfa took the penalty himself, thumping his effort in off the underside of the crossbar.
Newcastle thought they had the lead when Papiss Cisse emphatically headed home, but the effort was correctly ruled out for offside.
They had Elliot to thank when he reacted smartly to keep out Hoilett's snapshot after the winger's neat one-two with Bobby Zamora.
Yet the visitors were gifted the lead 10 minutes before the interval courtesy of some abject defending from Bosingwa and goalkeeper Rob Green.
Green, on the right edge of his area, rolled the ball to Bosingwa, who immediately placed his goalkeeper under pressure by returning possession straight to him.
Green's hurried kick was charged down by Jonas Gutierrez and fell kindly for Gouffran to shoot into the empty net.
There were cheers from Rangers fans when Shaun Derry and Fabio were introduced in place of Mbia and Bosingwa at the start of the second half.
Newcastle were forced into a change of their own early in the second half when Cheick Tiote hobbled off to be replaced by James Perch, and they had a lucky escape when Hoilett shot narrowly wide after a trademark dribble.
Elliot, already booked for kicking the ball away, was dismissed when he handled outside the area with nine minutes remaining. Ben Arfa was withdrawn for substitute keeper Steve Harper and Newcastle hung on for a pivotal victory.
QPR manager Harry Redknapp:
"It was poor from us, I was disappointed. We started well enough, got a penalty and got in front.
"The decision for their penalty was very poor, you'd be giving 20 penalties per game if you give those and it brought them back into it. Then the heads seemed to drop and we gave away a terrible second goal.
"It just about sums the season up. Jose made two mistakes, he didn't do it purposefully. The crowd got onto him and I felt we needed a change to get the fans going."
Newcastle manager Alan Pardew:
"We got the win we needed. It is a big relief because this is a massive club. The injuries we have suffered this year have been horrendous. This type of year usually ends up in relegation.
"It was a nervous display from us, and we really needed that first goal. We have made mistakes but we will make sure that we protect ourselves. The Premier League is so unforgiving."
Queens Park Rangers
- 01 Green
- 03 Traore
- 06 Hill
- 15 Onuoha
- 19 Bosingwa (Fabio - 46' )
- 16 Jenas
- 23 Hoilett (Taarabt - 84' )
- 29 Townsend
- 40 M'bia Booked (Derry - 46' )
- 18 Remy
- 25 Zamora
- 26 Murphy
- 20 Fabio
- 04 Derry
- 07 Park Ji-sung
- 10 Taarabt
- 14 Granero
- 12 Mackie
- 21 Elliot Dismissed after an earlier booking
- 02 Coloccini
- 06 Williamson Booked
- 13 Yanga-M'Biwa
- 26 Debuchy
- 04 Cabaye Booked
- 10 Ben Arfa (Harper - 82' )
- 18 Gutierrez
- 24 Tiote (Perch - 52' )
- 09 Cisse
- 11 Gouffran (Obertan - 77' )
- 37 Harper
- 05 Simpson
- 14 Perch
- 08 Anita
- 22 Marveaux
- 25 Obertan
- 49 Campbell