Ole Gunnar Solskjaer’s side fell behind to Michail Antonio’s penalty in the first half at Old Trafford.
But teenage forward Greenwood struck after the interval to lift United into third place in the Premier League.
United are ahead of fourth placed Chelsea on goal difference, but the Blues would regain third if they avoid defeat against champions Liverpool later on Wednesday.
Regardless of the result at Anfield, United will finish in the top four if they draw or win in their decisive showdown with fifth placed Leicester on Sunday.
United are one point ahead of Leicester going into their last game of the season at the King Power Stadium.
Solskjaer’s team were well below their best against West Ham, but they are now unbeaten in 13 league matches and will complete an impressive surge into the Champions League if they emerge unscathed at Leicester.
They can also qualify for Europe’s elite club competition if they win the Europa League in August.
Solskjaer will have been relieved there were no costly mistakes from David De Gea after the United keeper retained his place.
The Spaniard made two embarrassing errors that led to goals in United’s 3-1 FA Cup semi-final defeat against Chelsea on Sunday.
But De Gea has started every league game since Solskjaer took charge and the United manager backed him in a pre-match interview, saying: “Form might be temporary but class is permanent is that saying and he’s an absolutely top keeper.”
West Ham’s point ensured they are mathematically certain to avoid relegation.
Beaten for the first time in 20 matches in all competitions at the weekend, United had no time to sulk as they looked to secure that lucrative Champions League berth.
United knew draws against West Ham and Leicester would be enough to secure a top four finish.
After their sluggish show at Wembley, Solskjaer’s men made a more enterprising start this time and West Ham keeper Lukasz Fabianski was tested twice inside the first four minutes.
– Mature Greenwood –
Anthony Martial’s stinging strike from just inside the penalty area forced an excellent save from Fabianski, who then plunged to his right to keep out Greenwood’s effort.
Rashford tried his luck from 30 yards, but the forward’s powerful drive was too close to Fabianski, while Greenwood’s close-range shot was blocked by Ogbonna.
De Gea had been a spectator for the first 40 minutes and when he was finally called into action, Antonio’s header lacked the power to trouble him.
But De Gea still had to pick the ball out of the net moments before half-time after Paul Pogba handed West Ham a penalty.
Declan Rice’s free-kick was smashed straight at Pogba, who instinctively stuck up his arms to protect his face.
Despite Pogba dropping to the turf as though he had been hit in the head, VAR confirmed the France midfielder’s handball.
Antonio took the spot-kick, sending De Gea the wrong way for his sixth goal in his last three games.
United had let the first half drift out of their control, but Greenwood dragged them level with another demonstration of his remarkable maturity in the 51st minute.
Dropping deep to exchange passes with Martial, the 18-year-old kept his composure to drill a clinical finish past Fabianski from 12 yards.
No teenager has ever scored more goals in a single season in all competitions for United than Greenwood, whose 17th of the season moved him level with George Best, Brian Kidd and Wayne Rooney.
With Bruno Fernandes unable to exert his usual influence, United fell away after Greenwood’s goal and De Gea made a superb tip-over from Jarrod Bowen’s venomous blast before Rice shot narrowly wide from 25 yards.
Download our app and read this and other great stories on the move. Available for Android and iOS.