Hernandez poked home to break Newcastle's hearts as United stretched their lead at the top of the Barclays Premier League to seven points.
Newcastle took the lead three times, through James Perch's tap-in, Jonny Evans' controversial own goal and Papiss Cisse's fine finish, only to be pegged back on each occasion by Evans, Patrice Evra and Robin van Persie - before Hernandez settled proceedings.
The Magpies took the lead in the fourth minute when Perch tapped in after United goalkeeper David de Gea could only meekly parry Demba Ba's effort.
United fought back when Evans slotted into an empty net after Hernandez was denied by Tim Krul. Evans went from hero to villain when he put Danny Simpson's low cross-shot into his own net and although the linesman had flagged Cisse offside, the goal was allowed to stand due to the Senegal striker's 'non-active' role.
The hosts drew level just before the hour mark when Evra's low shot rocketed into the bottom corner.
The visitors refused to lie down, however, and former United winger Gabriel Obertan sprinted down the left before cutting it back to Cisse and he blazed past De Gea.
But it was just three minutes before Van Persie drove in his 16th goal of the season after Krul had saved his initial shot.
De Gea got away with a near-calamitous misjudgement when he allowed Sammy Ameobi's shot to roll past him, thinking it was going wide, only for it to hit a post and rebound straight back.
But Hernandez atoned for his earlier miss and settled this breathless clash with a lovely half-volley from Michael Carrick's ball over the top.