Arsene Wenger’s side took an early lead through Alexandre Lacazette, but Ayoze Perez equalised before Ritchie bagged the second half winner.
Newcastle’s fourth successive win ended Arsenal’s unbeaten run of seven games in all competitions.
The sixth-placed Gunners are 13 points behind fourth-placed Tottenham with only five games remaining in the race to qualify for the Champions League.
Realistically, Arsenal already had no chance of making the top four and Wenger had been prioritising their Europa League campaign for several weeks.
Arsenal saw off CSKA Moscow in the Europa League quarter-finals on Thursday.
They face Atletico Madrid in the last four and will qualify for the Champions League if they win the competition.
With little to play for in the league, Arsenal were unable to find enough momentum to maintain their recent revival, even though Lacazette opened the scoring in the 14th minute.
Just moments after he was left writhing on the turf following a crunching challenge from Kenedy, Lacazette exacted revenge.
Pierre-Emerick Aubameyang ran onto a long ball into the Newcastle area and picked out Lacazette, who stretched to volley home at the far post for his 13th goal of a difficult first season following his move from Lyon.
Alex Iwobi almost doubled Arsenal’s lead moments later with a stinging strike that forced a good save from Martin Dubravka.
Jonjo Shelvey’s long pass picked out Dwight Gayle in the Arsenal area and, with Gunners defender Shkodran Mustafi out of position, he was able to lay off to DeAndre Yedlin.
Perez made a perfectly-timed run to meet Yedlin’s cross with a fine finish that flashed by Petr Cech at his near post.
The Spanish forward’s third goal in his last three appearances was a clinical effort, but Wenger would have been furious with how easily Newcastle carved open his defence.
Calum Chambers could have restored Arsenal’s lead before the interval, but the defender shot wide from Mustafi’s knock down.
Ritchie tested Cech before 18-year-old Arsenal midfielder Joe Willock’s poor finish wasted an opportunity to mark his Premier League debut with a goal.
Iwobi lashed narrowly wide from long-range as Arsenal chased their first away point of 2018.
But it was Newcastle who landed the knockout blow in the 68th minute.
More sloppy Arsenal defending let in Islam Slimani and his header was flicked on by Perez to Ritchie, who beat Cech from close-range.
Ritchie clearly saves his goals for the big occasion, having scored the winner against Manchester United in February.
Kenedy, on loan from Chelsea, came close to putting the result beyond doubt with a looping effort that hit the crossbar with Cech beaten.
Lacazette should have equalised in the closing stages, but he shot into the side-netting.
Download our app and read this and other great stories on the move. Available for Android and iOS.