With the goal completely open in the 50th minute, Ritchie sliced a sidefooted shot with his favored left foot into the side netting from inside the six-yard box.
The score was already 2-1 at the time, with Ritchie having set up Ciaran Clark for Newcastle's second goal in the 23rd after an own-goal by Ben Mee put the visitors in front in the fourth minute.
Sam Vokes reduced Burnley's deficit in the 40th with a looping header from just inside the penalty area from Mee's raking pass forward.
Having failed to win any of its first 10 games in the Premier League, Newcastle has beaten Watford, Bournemouth and Burnley in succession to move out of the relegation zone and four points clear of the bottom three.
Burnley was in fourth-to-last place, one point from safety. It had one of the stronger defenses in the league last season, but only last-place Fulham has conceded more than Burnley (27 from 13 games) in this campaign.
The start of the game was delayed by 30 minutes after the referees' assessor, Eddie Wolstenholme, collapsed in the tunnel. He was taken to hospital and the Premier League said in a tweet that he was in a "conscious state."
Wolstenholme was formerly a Premier League referee who retired from officiating in 2003.