Loic Remy scored a stoppage-time winner as Newcastle ended a run of four successive home league defeats by beating Aston Villa at St James' Park.
Gabriel Agbonlahor went close for Villa with three first-half shots before Papiss Cisse sidefooted a Remy pass over from 10 yards at the other end.
Remy was found by Luuk De Jong's pass late on only to shoot against a post.
However, he atoned when he latched on to De Jong's deflected shot, cut inside Ron Vlaar and fired into the net.
Remy finish was special - Pardew
Remy's effort was Newcastle's first league goal at home in five games and provided Alan Pardew's side with their first win at St James' Park since Boxing Day.
The victory also took the Magpies to the 40-point target Pardew had set his side as they helped erase the memory of their poor recent form.
Villa have now lost three of their last four Premier League games and lie just four points from the relegation zone.
Ultimately, Remy proved the difference between the two sides and his return to the Newcastle XI, along with centre-back Fabricio Coloccini and midfielder Cheick Tiote, was key for the home team.
Villa, playing their first game following a training break in Portugal, are renowned for their threat on the counter-attack and the Magpies struggled to deal with the pace of their attacks in the opening half.
Striker Agbonlahor was a particular threat for the visitors and he had the goal in his sights when he gathered a Fabian Delph cross, only to see his guided 12-yard shot parried by goalkeeper Tim Krul.
Almost immediately, Agbonlahor sent a fizzing 25-yard strike just over after Newcastle failed to close him down.
Steve BowerBBC Match of the Day commentator
"The win is a huge relief for Newcastle and a massive three points for Alan Pardew. They left it very, very late but, after a run of four points from 24, Loic Remy put smiles back on Geordie faces."
It was Coloccini's return that appeared the crucial one at that stage, and the Argentine dived to deflect yet another Agbonlahor shot wide as Newcastle hung on in front of an anxious home crowd.
Cisse had a great chance to settle those nerves on the stroke of half-time but showed the sort of finishing to be expected of a forward with one goal in 22 previous top-flight outings. Tiote slid a pass through to Remy and he squared a ball that Cisse sidefooted over from 10 yards.
On the other side of the break, Yoan Gouffran dragged a shot wide, and Newcastle thought they should have had a penalty for a Leandro Bacuna handball.
It looked as if Remy would finally end Newcastle's goalscoring drought when De Jong robbed Vlaar and laid off a pass to the France international, only for his shot to come back off a post.
But Newcastle were the side exerting all the pressure late on and they were eventually rewarded when Remy scored his 12th league goal of the campaign.
Newcastle manager Alan Pardew:
"As a football manager, you are on 40 points - I think we have had a decent season. But the recent run put pressure on myself and the team, and my staff as well.
"I don't feel comfortable when my staff are under pressure. You can be very resilient as a manager, but I was uncomfortable for my staff this week.
Villa took too many chances - Lambert
"I was desperate to get them a result, and it was for them that I really wanted to get a win, and obviously our fans, who have had to be very, very patient at home."
Aston Villa boss Paul Lambert:
"I thought we deserved at least a point out of it, especially after the first-half showing.
"I thought we were excellent in that first half. In the second half, Newcastle came at us strongly, but I don't think either team probably deserved to win the game.
"It's really disappointing and frustrating because I don't think we deserved to lose the game. But with 30 seconds to go, you have got to play the ball long.
"You can't take a chance in that situation and we got punished."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.