The winger struck on 65 minutes after Florian Lejeune had denied Alexis Sanchez an open goal at the other end.
In the first half David De Gea saved from Jonjo Shelvey and Newcastle goalkeeper Martin Dubravka on his debut denied Anthony Martial one-on-one.
Ritchie's first goal of the season came when Lejeune and Dwight Gayle flicked on Shelvey's deep free-kick for the unmarked Scot to finish.
Man Utd were denied an equaliser by two goal-saving blocks by Gayle and a stoppage-time save by Dubravka.
The win lifts Newcastle out of the relegation zone to 13th. Man Utd remain second, but 16 points behind Manchester City and four ahead of Tottenham Hotspur.