The 19-year-old kept his composure to hit a low shot from outside of the area in the 72nd minute to settle a tight contest at St James’ Park.
Both teams had chances to score beforehand.
Man Utd's best effort came from Harry Maguire, who headed wide when unmarked at a corner at the end of the first half, while Longstaff hit the bar.
Newcastle's first home win of the season lifts them out of the bottom three to 16th on eight points, one behind Manchester United, who drop to 12th after an eighth away match without victory.
Newcastle: 19 Oct v Chelsea (A)
Man Utd: 20 Oct v Liverpool (H)