Substitute Alexander Isak scored an 89th-minute winner after Aleksandar Mitrovic’s penalty for Fulham was disallowed as Newcastle returned to third in the Premier League.
Club record signing Isak, on his first league appearance since September after injury, nodded home from close range at a jubilant St James’ Park.
Mitrovic looked to have given Fulham the lead against his former team, but his spot-kick was ruled out because he accidentally kicked the ball on to his standing foot when he slipped.
It was a dramatic final 30 minutes to a tight game which Newcastle edged without being able to create clear chances.
In the end Isak, who made a promising start to life on Tyneside before his injury, was in the right place to convert strike partner Callum Wilson’s knock-back.
Fulham manager Marco Silva was booked for protesting after the final whistle, with his side unfortunate to see their five-game winning run ended.
Newcastle are now one point second-placed Manchester City.
They have a five-point buffer over Tottenham as they continue their unexpected push for Champions League qualification, although Spurs will cut it to two if they beat leaders Arsenal later on Sunday.
Sweden striker Isak, a £60m signing last summer, scored twice in his first three games before being sidelined by a thigh injury.
Here he was sent on in the 71st minute and only had two touches in the Fulham box, one of which proved pivotal.
Newcastle had hit the post through a Fabian Schar free-kick in the second half but, without midfielder Bruno Guimares – who left the field in tears at half-time because of injury – they had been kept at arm’s length by an impressive Fulham.
Newcastle registered a fifth successive clean sheet in the Premier League for the first time, and an unbeaten run of 14 games is their joint best in the top flight.
The wave of optimism on Tyneside, boosted further by securing a first cup semi-final in 18 years on Tuesday, shows little sign of dying down.
Mitrovic’s penalty was unusual but the protests from Newcastle’s players were instant.
While the ball may have gone into the right side of Nick Pope’s goal, it did so via a deflection of Mitrovic’s left boot.
Referee Rob Jones awarded the spot-kick – for a foul against Kieran Trippier – after consulting the television monitor.
Immediately after another penalty appeal was waved away, Bobby Decordova-Reid seemed to make the first contact with Trippier’s boot before the England defender’s tackle then swept the forward to the ground.
Fulham had few further chances but deserved a point for their effort and defensive organisation.
The disappointment at losing to one of the Premier League’s leading sides shows how far the Cottagers have come.
They are sixth in the table on 31 points, having already beaten their tally from the last time they were in the top flight.