Eddie Howe’s side had only won once all season prior to this energetic and tempestuous encounter where both sides struggled to make the most of first-half chances.
But after Newcastle goalkeeper Martin Dubravka saved Dan James’ point-blank shot and Illan Meslier palmed Shelvey’s volley away, the visitors finally found a breakthrough.
The 75th-minute goal came from a brilliant run by substitute Javier Manquillo, who was brought down on the edge of the box.
Shelvey stepped up and fired past Meslier, who perhaps should have done better, given the ball went in on his side of the goal.
Leeds had earlier wasted a great chance through Jack Harrison, whose goal-bound shot was well-blocked by Fabian Schar.
It proved a turning point as Newcastle held on, despite dropping 21 points from winning positions already this season.
After Norwich’s win over Watford, Howe’s side failed to exit the bottom three, but such a victory could prove transformative to their relegation hopes ahead of a two-week break where the team will travel to Saudi Arabia for a training trip.
For Leeds, it ended successive league victories and they paid for their profligacy in the absence of injured striker Patrick Bamford.
Howe’s methods starting to bear fruit
The significance of Shelvey’s goal and the three points for Newcastle cannot be underestimated in the context of what has been a difficult season for the visitors.
Following the club’s October takeover by new Saudi owners, it was hoped a poor start could be eliminated once Howe was appointed as the new manager.
Further hope came when they entered the transfer window as Kieran Trippier and Chris Wood joined the club. But a porous defence has hampered their attempts to move up the table and frustrations in the transfer market this week led to a feeling among some fans that relegation looked increasingly likely.
Questions about their upcoming trip to Saudi Arabia hardly helped the mood.
But to hang on for a precious success sparked delight at the final whistle among the players and Howe, as Trippier and the manager led the applause in front of their travelling fans.
There were some fine displays from the visitors, who were tested by Marcelo Bielsa’s team in a, sometimes, frantic game where only poor finishing let both sides down.
Willock, who replaced Sean Longstaff in the starting line-up, showed his quality with some fine ball-carrying which not only relieved pressure on the defence but added to Allan Saint-Maximin’s presence in attack. The former Arsenal player could also have scored in stoppage-time but Meslier denied him with a good save.
Schar’s block proved crucial, while Longstaff – who replaced the injured Joelinton before the break – also contributed to a team performance which will give Howe hope for the future.
There have been questions about whether Howe was best suited to keep Newcastle in the top flight despite a previous relegation with Bournemouth. But after a positive display which only ended with a draw against Watford last week, this showed his team are moving in the right direction.