Mark Noble stepped off the bench for an injury time penalty – and saw it saved – as Jesse Lingard’s stunning late goal secured victory for Manchester United against his former club West Ham.
Lingard, who spent a successful loan spell at London Stadium last season, appeared as a substitute in the second half and with two minutes remaining he cut on to his right foot and fired into the top corner.
Further drama followed as Luke Shaw was adjudged to have handballed in the box and De Gea dived the right way to push away the spot-kick that had been taken by Noble, who was making his first touch after coming off the bench in the 95th minute.
Earlier in the contest, Cristiano Ronaldo had converted his fourth goal in three games since re-signing for Manchester United, poking home from close range on 35 minutes after Lukasz Fabianski had spilled the initial effort.
West Ham had taken the lead five minutes before that when Said Benrahma’s strike from outside the area went in after taking a huge deflection off defender Raphael Varane.
Bruno Fernandes had seen a first-time strike superbly tipped on to the post by Fabianski, who made a string of saves for the home side.
Victory ensures Ole Gunnar Solskjaer’s side remain unbeaten in the league this term with four wins and a draw, while West Ham suffered their first loss of the campaign.
Man Utd preserve unbeaten run on the road
The Red Devils were heavily criticised after a poor Champions League performance in Switzerland against Young Boys in midweek and were looking like being left frustrated in London.
But instead they maintained their incredible run away from home in the league and are now unbeaten in their last 29 top-flight games outside Old Trafford.
The game was meandering towards a draw until Lingard popped up to score superbly and the England international did not celebrate after being given a good reception by the home supporters.
The return of Ronaldo seems to be an inspired move by Solskjaer as the Portugal international continued his impressive return and he could have had more goals, as well as having a number of penalty appeals turned down.
Ronaldo flashed a shot straight at Fabianski and another effort was brilliantly tipped wide by the Polish goalkeeper, who also kept out efforts from Luke Shaw and Aaron Wan-Bissaka.
West Ham forwards Nikola Vlasic and Pablo Fornals both flicked efforts wide from promising positions and David Moyes’ side had a golden opportunity to claim a point in the dying seconds.
Andriy Yarmolenko’s cross hit Shaw’s outstretched arm and referee Martin Atkinson awarded the penalty after viewing the incident on the pitchside monitor.
Declan Rice initially took the ball but Noble came on for Jarrod Bowen and assumed responsibility, but his effort was brilliantly saved by De Gea.