Alexandre Lacazette fired the Gunners into an early lead at St. James’ Park, turning home Pierre-Emerick Aubameyang’s cross in front of the Gallowgate End.
But Ayoze Pérez’s superbly-taken effort restored parity, giving the Magpies a foothold in an absorbing contest.
And with just over 20 minutes left, Ritchie pounced, firing home the clincher to take United past the 40-point mark and earn a fourth successive home victory.
French forward Lacazette fired the first warning of the afternoon, dragging a shot well wide from the edge of the area, but with the game almost quarter of an hour old he made his mark.
A lofted ball down the left found Pierre-Emerick Aubameyang, who brought it down well and sent over an inviting cross for Lacazette. The former Lyon frontman’s controlled finish handed the Gunners an early advantage, with Lacazette becoming the first player to score past goalkeeper Martin Dúbravka at St. James’ in the process.
But barely 15 minutes later, United were level. Dwight Gayle latched on to Jonjo Shelvey’s pass over the top, and his control and lay-off allowed DeAndre Yedlin to centre. Pérez was there to meet it, connecting superbly to guide his first-time finish – and his third goal in as many games – beyond Petr Cech and draw the hosts level.
Defender Calum Chambers squandered a golden chance to put Arsène Wenger’s men back in front five minutes before the break, stretching to connect with Shkodran Mustafi’s headed cross but succeeding only in diverting it past the post.
And debutant midfielder Joe Willock also wasted an opening before half time, miscuing horribly after Lacazette had robbed Mo Diamé in the middle and squared it for him.
With Newcastle looking lively after the restart, Rafa Benítez introduced loan signing Islam Slimani in place of Gayle just after the hour. The Magpies were in the ascendency at that stage, with Ritchie thumping an effort off target and Pérez and Kenedy continuing to probe for opportunities in the final third.
And they were rewarded with just over 20 minutes remaining. Arsenal – who had just sent on Danny Welbeck – were caught at the back, as Slimani’s header was deftly touched on by Pérez into Ritchie’s pass. With Cech to beat, the Scotland international produced a cool finish, clipping the ball beyond the Gunners’ stopper with his unfavoured right foot to give Benítez’s side the advantage.
Buoyed by a 52,000-strong crowd, Newcastle almost made it three in the final quarter of an hour, with Kenedy’s deflected effort bounced off the crossbar and in-form Pérez found the sidenetting.
But it mattered little in the end, as United were posed few problems in the closing stages. Ritchie’s strike proved decisive, with the hosts extending their superb recent run of form.