Ritchie crashed into Swansea defender Alfie Mawson with a high boot just after half time in a challenge which was almost identical to the one which led to Sadio Mane's red card for Liverpool against Manchester City on Saturday.
However, referee Michael Jones opted to show the Scotland international a yellow card, and Ritchie admitted that he was fortunate to escape a more severe punishment.
"I had my eye on the ball but Mawson came lower than yesterday," he told reporters.
"I was delighted to see only a yellow card. I looked to the referee and I was lucky."
Jamaal Lascelles scored the only goal of the game in South Wales as Newcastle recorded their first Premier League away win since December 2015.