An early penalty from Loic Remy gave the home side the lead, but Hatem Ben Arfa also scored from the spot to equalise before the Frenchman capitalised on Rob Green's fatal error
Loic Remy put the home side ahead with an early penalty but Hatem Ben Arfa equalised with a spot-kick of his own, before Yann Gouffran was afforded the luxury of an empty net to give Newcastle the lead.
The hosts improved in the second half – but were still nowhere near good enough to grind any kind of result out and the Magpies held on to clinch a vital three points.
The result guarantees safety for Alan Pardew’s men as they rise six points clear of 18th-placed Wigan - who have two games left to play, but one is against fellow strugglers Aston Villa.
Both sides set out with attacking line-ups as Harry Redknapp named a front three of Remy, Junior Hoilett and Bobby Zamora, while the visitors lined up with Gouffran and Ben Arfa in behind top scorer Papiss Cisse.
It was the hosts who came racing out of the blocks – despite enough noise from the away end to make it seem like Newcastle were the home side.
And QPR were rewarded with a goal after just 10 minutes as Hoilett advanced into the penalty area and was brought down by Mathieu Debuchy.
There seemed to be a hint of simulation as Hoillett tumbled to the ground but that didn’t stop the clinical Remy from stepping up and slotting home past keeper Rob Elliot.
Yet Newcastle hit back just minutes later, and in identical fashion. Bosingwa – booed by the home fans throughout the first 15 minutes – was penalised for pulling Ben Arfa’s shirt inside the area and the Frenchman stepped up to rocket the ensuing spot-kick straight into the top corner.
The visitors once again found themselves on the back foot thereafter as Elliot was forced into two vital stops on the half-hour mark.
But it was Newcastle who would strike next – and with a simply comical goal. Bosingwa, by this point treated as public enemy number one by the home supporters – played a short back-pass to Rob Green, who was then left under tremendous pressure. The keeper fumbled his clearance and Gouffran coolly finished into an empty net.
Bosingwa was deservedly hauled off at half-time but the Magpies’ lead carried into the break and far beyond.
Hoilett tried to inject some urgency into the hosts after an hour as he made his way past several yellow shirts to fashion himself a good opening – but the shot that followed sailed narrowly wide of Elliot’s goal.
Then, the away side came close as a swarm of shirts contested a loose ball in the QPR danger area. Jonas Gutierrez came closest to scoring but the home defence did just enough to clear.
But, in one final twist, Elliot was sent off after he picked the ball up outside his area and the visitors were down to ten men. Newcastle held on, however, and are now clear of relegation danger.