Marcus Rashford’s 93rd-minute winning goal lifted some of the mounting gloom around Manchester United as the substitute scored with virtually the last touch of the game.
The England International turned in a cross from fellow substitute Edinson Cavani at the far post to keep United firmly in the chase for fourth place.
And, despite the unconvincing and laboured manner of the win, United have now lost just once in the interim manager’s ten games in charge, and just once in 13 since OIe Gunnar Solskjaer was sacked.
But they have also scored just seven goals in six games at Old Trafford on Rangnick’s watch - three of those coming in a win against bottom-placed Burnley.
And, for long spells against former manager David Moyes, it looked like it would be a familiar story of frustration.
Fred finally produced the game’s first on-target effort, four minutes after the restart, appearing at the end of a flowing move started by Bruno Fernandes and featuring a neat touch by Cristiano Ronaldo.
Alphonse Areola, on loan at West Ham from PSG and making his Premier League debut for the club, parried his shot comfortably.
It was the first sign of life from a game that had delivered little to that point.
Ronaldo missed the best chance of the first half, flinging himself at Fernandes’s left-wing cross but failing to connect with an attempted diving header.
And the Portuguese had a hopeful penalty appeal dismissed after minor contact from Hammers defender Kurt Zouma.
After the restart and Fred’s chance, West Ham quickly responded with Jarrod Bowen lashing a shot wide from just inside the area after a corner fell conveniently for him.
Harry Maguire, in for Victor Lindelof who was with his family after a midweek burglary at their home, was soon booked for a foul on Bowen.
And, as the second half continued to prove more eventful, Raphael Varane glanced just over from an Alex Telles corner.
Anthony Elanga also maintained the United pressure, volleying well wide from Diogo Dalot’s centre, in what would prove to be the young winger’s last act of the game.
Marcus Rashford was brought on to replace him and quickly proved a handful, with Declan Rice earning a caution for dragging him back.
But the day could have belonged to the Hammers, for whom Tomas Soucek almost scored a dramatic 87th-minute winner as he headed just wide from a Bowen corner.
De Gea; Dalot, Maguire, Varane, Telles; Fred (Cavani 81), McTominay; Greenwood (Martial 81), Fernandes, Elanga (Rashford 62); Ronaldo.
Jones, Mata, Lingard, Henderson, Matic, van de Beek.
Areola; Coufal (Fredericks 70), Dawson, Zouma, Cresswell; Rice, Soucek; Bowen, Lanzini, Fornals; Antonio.
Yarmolenko, Vlasic, Noble, Diop, Masuaka, Johnson, Kral, Randolph.