Match ends, Newcastle United 1, Swansea City 2.
A Wilfried Bony penalty in stoppage time ensured Swansea crept closer to Premier League safety and increased the pressure on Alan Pardew's Newcastle.
The Magpies, lacking confidence after four successive defeats, took the lead against the run of play thanks to Shola Ameobi's finish into the bottom corner.
But Bony headed home from a Ben Davies corner to level before the break.
The match seemed to be petering out when Marvin Emnes was felled by Cheick Tiote and Bony struck from the spot.
Newcastle's players had no time to respond, although their fans had ample opportunity to make their displeasure known as they watched Swansea's players and their coach Garry Monk celebrate on the pitch at the final whistle.
The Welshmen seemed to have settled for a draw before influential substitute Emnes weaved into the box and helped secure the points which take Swansea six points clear of the relegation zone.
If Swansea could have chosen their opponents after a week in which the club had to admit to "a couple of incidents between certain players" during training before last Sunday's defeat by Chelsea, it would probably have been Newcastle - a team they had beaten in their three previous league meetings.
But Newcastle have been obliging opponents to many teams this year, with this loss not only their fifth on the trot but also their ninth defeat in 12 league games.
However, for a match which ended so dramatically, it began with a moment of slapstick as referee Chris Foy was knocked to the floor in the first minute by the power of Jonjo Shelvey's ricocheted long-range effort, and was eventually replaced by fourth official Anthony Taylor.
Foy needed a moment to regain his composure after the blow to the face, but once the match did get under way, it was mostly played in Newcastle's half.
Swansea's midfield trio of Leon Britton, Shelvey and Jonathan De Guzman, dominated the middle of the pitch against what was, at times, a two-man Newcastle midfield as Pardew selected an attacking line-up after four games without neither a victory nor a goal.
But for all the possession enjoyed by Swansea, it was Newcastle who opened the scoring thanks to Ameobi's first goal since December 2012.
The striker outmuscled Davies in the air and, after combining with Luuk de Jong, found the bottom corner with his team's first shot on target.
Swansea gradually regained control and they were also assisted by first-half injuries to Newcastle forwards Papiss Cisse and De Jong.
With half-time looming, Swansea levelled as Bony rose above Newcastle's defence to head in for his fourth successive goal away from home.
The Magpies improved after the break, with both Dan Gosling and Vurnon Anita testing Michel Vorm in the visiting goal.
But the best chance of the half fell to Bony, who was put through by a defence-splitting pass by Emnes only for Tim Krul to sprint off his line and snuff out the danger.
But the Dutchman had one last chance to earn Swansea their third win during Monk's two-month tenure and did so, beating Krul to his right to spark wild celebrations in the away stand.
For a gallery of photos from Saturday's Premier League action, visit BBC Sport's Facebook page.
Swansea manager Garry Monk: "We started well in the first 20 minutes, but then they got the goal and we got a bit sloppy in our passing.
"Thankfully, our second goal was a penalty. It was good to get those rewards. We've played a lot better than we've done today and come away with nothing.
"It's been a difficult season and very inconsistent for the standards we've set. We're just trying to get a job done and these three points go a long way to doing that."
Newcastle manager Alan Pardew: "It was a game that looked like it was going to a draw. I felt we played a lot better and it was a killer blow that last goal.
"There's no way we should have allowed that to happen. There were three or four errors in that goal. I felt we should have won this game, but errors in both halves cost us dear.
"I'm disappointed because their effort was there, but we're making errors and getting punished for it and we can't afford to do that on the run we are on. We're going to have to grin and bear it and see what we can do."
- 24TiotéBooked at 90mins
- 9CisséSubstituted forDebuchyat 21'minutes
- 15GoslingBooked at 32minsSubstituted forArmstrongat 81'minutes
- 18de JongSubstituted forRemyat 40'minutes
- 20De Guzmán
- 11HernándezSubstituted forEmnesat 81'minutes
- 15RoutledgeSubstituted forBartleyat 90+4'minutes
- Chris Foy
- Shots on Target
Second Half ends, Newcastle United 1, Swansea City 2.
Substitution, Swansea City. Kyle Bartley replaces Wayne Routledge.
Goal! Newcastle United 1, Swansea City 2. Wilfried Bony (Swansea City) converts the penalty with a right footed shot to the top right corner.
Cheick Tioté (Newcastle United) is shown the yellow card for a bad foul.
Penalty Swansea City. Marvin Emnes draws a foul in the penalty area.
Penalty conceded by Cheick Tioté (Newcastle United) after a foul in the penalty area.
Offside, Swansea City. Michel Vorm tries a through ball, but Wayne Routledge is caught offside.
Attempt missed. Cheick Tioté (Newcastle United) right footed shot from outside the box is high and wide to the left. Assisted by Shola Ameobi.
Foul by Wilfried Bony (Swansea City).
Vurnon Anita (Newcastle United) wins a free kick in the defensive half.
Foul by Jordi Amat (Swansea City).
Adam Armstrong (Newcastle United) wins a free kick on the left wing.
Jonathan De Guzmán (Swansea City) wins a free kick in the defensive half.
Foul by Paul Dummett (Newcastle United).
Foul by Wayne Routledge (Swansea City).
Cheick Tioté (Newcastle United) wins a free kick in the defensive half.
Foul by Wilfried Bony (Swansea City).
Mathieu Debuchy (Newcastle United) wins a free kick in the defensive half.
Substitution, Newcastle United. Adam Armstrong replaces Dan Gosling.