Fourth-place Chelsea went into the game looking to strengthen its hold on a Champions League spot and to start threatening teams above like Manchester City, which drew 2-2 with Crystal Palace earlier in the day.
Newcastle's chances seemed to have come and gone when Brazilian forward Joelinton knocked a shot wide from a good position in the 88th, having also hit the crossbar in the first half. However, a corner in the fourth minute of added time proved the turning point.
Ritchie's delivery from the corner was poor, but so was the Chelsea clearance to Newcastle's Allan Saint-Maximin. He promptly delivered a curling cross from deep which was perfectly angled for Hayden to head in the winning goal.
Newcastle's injury problems are piling up this season, and got worse when Dutch left-back Jetro Willems went off after 12 minutes with an apparently serious knee injury.
Chelsea had its own injury woes when right-back Reese James went off in the 75th holding his shin.