Newcastle looked to have been building some momentum prior to that strike, but rarely threatened thereafter and Felipe Anderson made it 3-0 when he took a pass from fit-again substitute Jack Wilshere, rode a challenge from Fabian Schar and nutmegged Dubravka.
Anderson told West Ham TV: "Certainly this season we haven't been able to be consistent".
"Javier has always been a very important player for us".
"But now we expect to change that flow and manage to have a streak of victories to realise our potential".
If the Hammers were bruised from their 4-0 home defeat by Manchester City a week earlier, they did not show it on Tyneside.
Perez endured a torrid time in front of goal during the first half, initially heading over from a corner when unmarked and then failing to hit the target with his left and right foot.
"I can not complain of the effort of the players or the commitment but again today we had chances, but they scored theirs".
Anderson's pace down the left caused Newcastle all kinds of problems, but it was Mexico worldwide Hernandez who put them to the sword.
The Mexico forward had been hampered by a virus, but Pellegrini said: "He has recovered his shape now and I hope he will continue to score lots of goals for us".
'For five weeks, Javier couldn't move, not just that he couldn't play, ' said Pellegrini about the period in September and early October. 'He had some chances and the fans expected him to score. What they spend, what we spend, you can see that on the pitch.
"Still I think we did well enough to create and then maybe to score, but we didn't do it and the second goal, it was very hard for us".