Nemanja Matic struck in stoppage time as Manchester United came from two goals down to secure a vital 3-2 victory at Crystal Palace.
An unconvincing start from Jose Mourinho's team contributed to goals from Andros Townsend and Patrick van Aanholt - the second shortly after half-time - but after repeatedly threatening they snatched all three points through Chris Smalling, Romelu Lukaku and then Matic.
United's initial sluggishness suggested they were distracted by the prospect of Saturday's fixture with rivals Liverpool, but they fought back convincingly, extending Palace's winless run to six and denying them a win that would have taken them from 18th to 13th in the Premier League.
While avoiding a first-ever Premier League defeat by Palace, United also moved ahead of Liverpool and up to second while continuing to build the sense of momentum that began with their recent victory over Chelsea.
Roy Hodgson's team, who this season at Selhurst Park had held runaway leaders Manchester City, were without the on-loan Timothy Fosu-Mensah, ineligible against his parent club.
Amid injuries to 10 senior players they again had Martin Kelly and Jeffrey Schlupp available, and both started as they made a promising start.
Townsend put them ahead in the 11th minute. The improving Christian Benteke played a square ball to the winger on the edge of the area from where his well-struck shot flew beyond goalkeeper David De Gea via a significant deflection off Victor Lindelof.
They threatened again before half-time and were rarely stretched, but it took until three minutes after the restart for the Eagles to double their advantage.
From a quickly-taken free-kick, Schlupp sent Van Aanholt through on goal and, despite suspicions of offside, his cool finish beat De Gea.
Mourinho had at half-time introduced Marcus Rashford for Scott McTominay and adopted a more attacking shape, and after Palace went 2-0 up it began to show.
Smalling had already gone close when, in the 55th minute, he gave them the lift they needed with United's first goal. Antonio Valencia picked him out with a fine cross from the edge of the area and, under minimal pressure, he headed the ball back across Palace goalkeeper Wayne Hennessey and into the back of the net.
Matic then saw an effort cleared off the line by Benteke before, in the 76th minute, his fellow Belgian Lukaku found the vital equalising goal. After Alexis Sanchez struck the crossbar the striker collected the rebound and remained patient before picking his spot and calmly finishing low beyond Hennessey.
De Gea was then needed to produce an outstanding save from a header from Benteke when for a period Palace looked the likeliest winners, and before Matic scored his first goal for the club to complete the visitors' fightback.
It had just been confirmed that three minutes of stoppage time would be played when, following a cross into Palace's penalty area which came back out off James McArthur, the Serbian met the loose ball with a powerful strike from 25 yards that Hennessey had little chance of stopping.