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 Rangers' relegation, 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
Live Text Commentary
Full Time The referee ends the match.90:00 +1:08
Effort from just outside the box by Andros Townsend goes over the bar.90:00 +0:48
Loic Remy takes a shot. Blocked by Fabricio Coloccini.88:46
Effort on goal by Bobby Zamora from inside the penalty box misses to the right of the target.87:32
Bobby Zamora is caught offside. Indirect free kick taken by Steve Harper.85:05
Papiss Cisse takes a shot. Save by Rob Green.83:12
Jermaine Jenas restarts play with the free kick.83:12 Substitution
Substitution Adel Taarabt is brought on as a substitute for David Hoilett.83:12
Fabricio Coloccini is penalised for handball and concedes a free kick.82:29
Fabio Da Silva takes a shot. Fabricio Coloccini gets a block in.80:46 Substitution
Substitution Hatem Ben Arfa goes off and Steve Harper comes on.80:46 Substitution
Substitution Steve Harper joins the action as a substitute, replacing Hatem Ben Arfa.80:15
Rob Elliot handles the ball and concedes a free kick. Direct free kick taken by Andros Townsend.78:01
Free kick awarded for a foul by Andros Townsend on Mapou Yanga-Mbiwa. Rob Elliot restarts play with the free kick.76:34
Rob Elliot takes the direct free kick.76:34 Substitution
Substitution Gabriel Obertan joins the action as a substitute, replacing Yoan Gouffran.76:34
Shaun Derry concedes a free kick for a foul on Papiss Cisse.74:11
Bobby Zamora is flagged offside by the assistant referee. Rob Elliot takes the free kick.68:57
Inswinging corner taken from the left by-line by Yohan Cabaye, Jonas Gutierrez takes a shot. Blocked by Shaun Derry. Unfair challenge on Andros Townsend by Mapou Yanga-Mbiwa results in a free kick. Jermaine Jenas restarts play with the free kick.68:21
Shaun Derry has shot on goal from just outside the penalty box which goes wide of the right-hand upright.
Dismissal Rob Elliot is sent off.67:23
Jermaine Jenas takes the direct free kick.67:23 Booking
Booking The referee shows Rob Elliot a yellow card.67:08
Jonas Gutierrez gives away a free kick for an unfair challenge on Loic Remy.66:40
Hatem Ben Arfa takes a shot. David Hoilett gets a block in.66:14
Free kick taken by Hatem Ben Arfa.63:23
Loic Remy is ruled offside. Free kick taken by Rob Elliot.61:45
Effort from the edge of the box by David Hoilett goes wide of the left-hand post.59:52
Hatem Ben Arfa takes a shot. Nedum Onuoha gets a block in. Unfair challenge on David Hoilett by Mathieu Debuchy results in a free kick. Free kick taken by Armand Traore.55:33
Jermaine Jenas concedes a free kick for a foul on James Perch. Direct free kick taken by Rob Elliot.53:30
Jonas Gutierrez handles the ball and concedes a free kick. Shaun Derry takes the free kick.50:58 Substitution
Substitution Cheick Tiote leaves the field to be replaced by James Perch.45:49
The referee blows for offside against Loic Remy. Rob Elliot restarts play with the free kick.45:01
The second half has started.45:01 Substitution
Substitution Shaun Derry comes on in place of Stephane Mbia.45:01 Substitution
Substitution Jose Bosingwa leaves the field to be replaced by Fabio Da Silva.45:00 +3:08 Half time
Half Time The players leave the pitch at half time.45:00 +2:14
The assistant referee flags for offside against Bobby Zamora. Indirect free kick taken by Rob Elliot.44:47
Effort from long distance by Yohan Cabaye goes wide right of the goal.40:44
Effort on goal by Jonas Gutierrez from just inside the penalty area goes harmlessly over the target.40:04
The offside flag is raised against Bobby Zamora. Rob Elliot takes the free kick.36:06
Rob Elliot restarts play with the free kick.36:06 Booking
Booking Stephane Mbia receives a caution for unsporting behaviour.35:47
Free kick awarded for an unfair challenge on Cheick Tiote by Stephane Mbia.34:10
Assist on the goal came from Jonas Gutierrez.34:10 Goal scored
Goal! - Yoan Gouffran - QPR 1 - 2 Newcastle Yoan Gouffran gets on the score sheet with a goal from long range to the bottom right corner of the goal. QPR 1-2 Newcastle.32:35
David Hoilett takes the inswinging corner, Rob Elliot makes a save.31:15
The assistant referee flags for offside against David Hoilett. Indirect free kick taken by Rob Elliot.30:48
David Hoilett takes a shot. Save made by Rob Elliot.29:35
Direct free kick taken by Jermaine Jenas.29:35 Booking
Booking Mike Williamson is cautioned by the ref for unsporting behaviour.29:25
Mike Williamson concedes a free kick for a foul on Stephane Mbia.27:52
Unfair challenge on Stephane Mbia by Papiss Cisse results in a free kick. Stephane Mbia takes the direct free kick.26:39
The official flags Mathieu Debuchy offside. Indirect free kick taken by Rob Green.23:57
Jermaine Jenas challenges Cheick Tiote unfairly and gives away a free kick. Rob Elliot restarts play with the free kick.21:42
The offside flag is raised against Papiss Cisse. Rob Green restarts play with the free kick.18:54
Stephane Mbia challenges Cheick Tiote unfairly and gives away a free kick. Free kick taken by Fabricio Coloccini.17:45 Goal scored
Goal! - Hatem Ben Arfa - QPR 1 - 1 Newcastle Penalty taken right-footed by Hatem Ben Arfa and scored. QPR 1-1 Newcastle.16:44
Yohan Cabaye takes a shot. Blocked by Jose Bosingwa. Hatem Ben Arfa takes a shot. Clint Hill gets a block in. Jose Bosingwa concedes a Penalty for a foul on Hatem Ben Arfa.15:08
The assistant referee signals for offside against Papiss Cisse. Free kick taken by Jose Bosingwa. Corner taken left-footed by Andros Townsend to the near post, Jonas Gutierrez manages to make a clearance.14:17
Stephane Mbia concedes a free kick for a foul on Jonas Gutierrez. Fabricio Coloccini takes the free kick.13:44
Effort on goal by Yohan Cabaye from just inside the box goes harmlessly over the target.13:10
Outswinging corner taken by Hatem Ben Arfa, Jermaine Jenas makes a clearance.10:31
Assist by David Hoilett.10:31 Goal scored
Goal! - Loic Remy - QPR 1 - 0 Newcastle Placed penalty scored by Loic Remy. QPR 1-0 Newcastle.10:12 Booking
Booking Yohan Cabaye goes into the book.9:35
Foul by Mathieu Debuchy on David Hoilett, Penalty awarded.8:51
Mathieu Debuchy gives away a free kick for an unfair challenge on David Hoilett. Stephane Mbia restarts play with the free kick.5:08
Andros Townsend fouled by Yoan Gouffran, the ref awards a free kick. Bobby Zamora has a direct shot on goal from the free kick.1:24
The referee blows for offside against Yoan Gouffran. Rob Green takes the free kick.0:00
The referee gets the game underway.
Live data and text provided by our data suppliers