All 52 of West Ham striker Javier Hernandez's Premier League goals have been scored from inside the box
West Ham produced a thrilling late comeback to stop relegation-threatened Huddersfield Town moving off the bottom of the Premier League for the first time since December.
Huddersfield led 3-1 with barely 15 minutes left before substitute Javier Hernandez inspired an incredible turnaround.
After Angelo Ogbonna thumped in a header to make it 3-2, Hernandez - who was introduced by Hammers manager Manuel Pellegrini at half-time - scored twice in the closing stages to spark jubilant celebrations at London Stadium.
"We came back pretty good with the effort of the whole team," the Mexican said. "In the second half we weren't sure if we could do it but we could."
When skipper Mark Noble cracked in a penalty to put West Ham ahead, few could have predicted the drama which would unfold in east London.
Huddersfield arrived without a victory on the road since November - and a mountain of injury problems - but their confidence was not dented as they levelled almost instantly through Juninho Bacuna's free header.
And the away fans had more to celebrate when a well-worked free-kick ended in young forward Karlam Grant sidefooting them ahead.
Grant, 21, cracked a thunderous 25-yard strike into the top corner after the break, leaving many inside London Stadium shellshocked and heading for the exits as the match approached the final 15 minutes.
But Ogbonna's header gave the home side hope, before Hernandez's headed double crushed Huddersfield and left them 16 points adrift of safety with seven matches left to play.
The Hammers consolidated their place in the top half as a result, staying ninth in the table - two points behind seventh-placed Wolves - after earning a third straight Premier League win at London Stadium for the first time.
Experience proves the key for the Hammers
West Ham boss Pellegrini has been determined to get to the root of his team's inconsistent performances this season, yet this thrilling match only served to show why the Chilean has been left frustrated.
The Hammers have taken points from home games against Liverpool, Chelsea, Arsenal and Manchester United this season, only to slip to away defeats at Brighton, Burnley, Bournemouth and Cardiff.
Against a Huddersfield side which had only taken six points on the road this season, many would have picked this as a home banker.
However, the Hammers struggled to break down an organised away side for the opening 75 minutes, with the likes of Marko Arnautovic - coming in from the cold to make his first start since January - and Felipe Anderson unable to produce the creativity which they showed earlier in the campaign.
And, although Huddersfield's opening two goals came from set-pieces, there were plenty more worrying moments as the Hammers were often left exposed at the back.
But it was the introduction of former Manchester United striker Hernandez, and another Premier League title-winner in French attacking midfielder Samir Nasri, who was introduced for the final half an hour, which ultimately paid dividends.
Nasri showed the guile and composure which made him part of Manchester City's success with a cool delivery from the right to the far post where Hernandez was left unmarked to stoop and head in the equaliser.
With momentum behind them, West Ham pressed for the winner and Anderson's left-wing cross picked apart the away defence, allowing Hernandez to nip in ahead of Town keeper Jonas Lossl and head home.
"I think this is a match for the fans," Pellegrini said. "I think everyone was disappointed when we were 3-1 down but we did well to come back.
"I really hate it when my team play bad. Winning or losing I want to play well. But winning is the important thing."
Switching off at set-pieces proves costly for Huddersfield
While Pellegrini had an air of surprised satisfaction in his post-match interviews, Huddersfield counterpart Jan Siewert could barely contain his anger.
Going into the match Huddersfield had only scored 15 league goals all season, netting twice in the same game just once in a 2-1 win over Wolves under Siewert's predecessor David Wagner in November.
The German watched his side clinically take their opportunities when they arrived against the Hammers, only to see their hopes of only a second away league win of the season undone by defensive lapses.
All three of the Hammers's second-half goals came from left-wing corners taken by Aaron Cresswell.
Tighter marking may have prevented Ogbonna climbing highest to head in the second, while the away side were slow to react when Nasri collected a partially-cleared set-piece for the second and Anderson picked up a short corner before clipping in for the third.
"I worked everything out to give my players a possibility of winning here and they showed it - we were winning 3-1 but then they lost it with three situations," former Borussia Dortmund reserve-team boss Siewert, who replaced Wagner in January, said.
"For me it's hard to describe at the moment."
Huddersfield's prospects of avoiding a return to the Championship after two seasons in the Premier League were already looking less than slim, but the travelling supporters looked set to be given some rare cheer.
In fact, they could still have been celebrating victory even after the Hammers had levelled.
That extraordinary finish almost saw Terence Kongolo swing the game back in Town's favour when he found himself clean through at 3-3, only to see his casual left-foot curler palmed away by Lukasz Fabianski before team-mate Jason Puncheon volleyed over a difficult chance on the rebound.
"Can't you see on my face that I'm not totally disappointed?" Siewert added.
"We were leading on the pitch - we scored three goals - something we haven't done already this season. And then we lost it."
'I'm still trying to figure out what happened!' - post-match reaction
West Ham captain Mark Noble said: "I'm still trying to figure what went on to be honest.
"We were pushing to get the second and they scored a breakaway third goal and I think everyone thought it was over - except us.
"We dug ourselves out and in the end, even though it was tight, we deserved the win.
"I'd take a 1-0 win over that all day long - especially when we go 3-1 down. But at the end of the day that's the Premier League. No game is easy and you have to turn up.
"I'm pleased we've kept our run going at home and we needed to bounce back after Cardiff last week."
Man of the match - Javier Hernandez (West Ham)Hernandez might have only been on the pitch for 45 minutes, and only had 21 touches in that time, but his predatory instincts in the box proved to be differenceHow Noble has joined Di Canio and Cole - the stats
West Ham have come from at least two goals behind to win on two other occasions in the Premier League, having done the same against Bradford in February 2000 (5-4) and Everton in March 2016 (3-2).This was just the eighth time Huddersfield have scored more than one goal in a Premier League game, but the first they have not gone on to win after seven previous victories and a draw.West Ham are unbeaten in 17 Premier League games in which they have scored a goal since a 3-1 defeat at Arsenal in August.Huddersfield scored as many goals against West Ham this afternoon as they had in their previous 11 Premier League games combined.Hernandez today became the first West Ham player to score two headed goals in a Premier League match since Michail Antonio against Watford in September 2016.Mark Noble became only the third player to score 40 Premier League goals for West Ham after Paolo Di Canio (47) and Carlton Cole (41).What's next?
After the international break, West Ham return to action on Saturday, 30 March with another home game against Everton (17:30 GMT).
Huddersfield go back on the road again, travelling to Crystal Palace on the same day (15:00).
More to follow.