Steve Bruce's side moved out of the drop zone and to within a point of the ailing Reds, sealing his first win against his former side in 23 attempts as a manager.
Longstaff, 19, playing in midfield alongside brother Sean - touted by United in the summer - could have scored in the first half but rattled the crossbar with a thunderous 25-yard drive, while Fabian Schar flicked a header narrowly over from a corner.
We again looked bereft of ideas in front of goal: Andreas Pereira's curling strike was comfortable for Martin Dubravka, while Harry Maguire nodded a free header wide from four yards.
The visitors' tally of nine points after eight games is their lowest since the 1989-90 season, when they were a point worse off.
The lively Allan Saint-Maximin dragged a shot wide, Miguel Almiron continues to seek his first goal for the club as a low shot was brilliantly blocked by Harry Maguire, and substitute Andy Carroll steered a diving header over the bar.
Maguire had United’s best chance of the game, heading Ashley Young’s corner wide just before half-time.
Saint - Maximin flashed wide from distance, and David de Gea did well to save from the impressive Almiron.
Daniel James, the standout player of each of our last two away matches in the Premier League, at Southampton and West Ham, showed glimpses of his raw pace, winning two free-kicks in quick succession which the Reds were unable to take advantage of.
United were dominating possession, with the home side attempting to hit us on the break, but it was the Magpies who were enjoying the best chances in front of goal.
Matty Longstaff rattled the crossbar on 28 minutes with an effort from outside the box after the Magpies got forward in numbers, before Fabian Schar glanced his header just too high, so it nestled on top of De Gea’s net, rather than inside it.
Hearts were then in mouths as Almiron beat the offside trap to latch on to Schar’s long ball, but Maguire did magnificently to recover and get a toe in the way to prevent the Magpies’ playmaker from opening the scoring.
Substitute Andy Carroll went close with a header, and Andreas Pereira's teasing ball in narrowly evaded the stretching James at the other end.
But the threat on the break from the first half remained and, when United failed to win the ball off the onrushing Jetro Willems, the full-back teed up the younger Longstaff, who finished superbly past De Geafrom 20 yards.
The Magpies – buoyed by only their second home goal of the season – now sat even deeper, inviting the Reds to break them down and despite the unrelenting efforts of United’s mass of 3,000 fans, Solskjaer’s men were unable to find a reply, with Marcos Rojo going closest with a header which flew just over Martin Dubravka’s crossbar.
Overall team performance: No rating
United Faithful Man of the Match: Axel Tuanzebe
A special mention to United's travelling support, who were once again absolutely magnificent at SJP.