United coach Ralf Rangnick started with Ronaldo at centre forward with 19-year-old Anthony Elanga and Mason Greenwood to his left and right but the combination produced very little. Rashford was brought on for Elanga in the 62nd minute and then 20 minutes later Rangnick rolled the dice by throwing on Cavani and Martial and switching to a 4-2-4 formation.
The move paid off when all four combined for the winner in the third minute of the three minutes added on.
Ronaldo fed the ball into Martial who slipped it outside to Cavani. The Uruguayan looked close to offside before he hit a cross to Rashford, who scored from the point blank range.
VAR looked back at the goal and there was a second roar around Old Trafford as it ruled Cavani had been onside.
“The atmosphere [in the dressing room] is amazing,” said Rangnick. “Quite rightly the boys were celebrating. They know what a massive win this was.
“Those are the best kind of wins when the other team has not time to come back. We are extremely happy with the performance and the level of physicality we played with, bearing in mind we played three days ago at Brentford.”