Under-fire Rafael Benitez survived a late scare on a night when Real Madrid won their Champions League group, conceding three late goals against Shakhtar Donetsk.
Cristiano Ronaldo's brace complemented goals from Luka Modric and Dani Carvajal at the Lviv Arena, although the pressure has not entirely been lifted on their manager.
Benitez was given a vote of confidence by club president Florentino Perez following Saturday's rout by Barcelona, but both will have watched the last 12 minutes in horror as Shakhtar clawed it back to 4-3 through Alex Teixeira's double and Dentinho.
Only four players remained from the team thumped 4-0 by Barca, with Ronaldo, Gareth Bale, Raphael Varane and Modric the survivors for this Group A encounter.
The visitors took the lead in the 19th minute when the lively Bale capitalised on an error by Andriy Pyatov to cross for Ronaldo to head home from close range.
The Portuguese should have added another just after the half-hour mark, only to direct his effort straight at the Shakhtar goalkeeper.
The hosts were gaining a foothold in the game, but lacked the cutting edge needed to capitalise on their possession.
It allowed Benitez's men to double their lead five minutes into the second half, with Casemiro and Ronaldo combining to set up Modric for a superb goal.
Ronaldo should have made it three a minute later, but Real only had to wait seconds for their next goal as their star player passed for Carvajal to steer home.
The rout continued in the 71st minute as Bale escaped down the left wing before picking out Ronaldo, who was able to score at the second attempt.
However, seven minutes later Real began to unravel, with Teixeira on target from the spot before Brazilian compatriot Dentinho bundled home a corner.
Real were subjected to a nerve-shredding final five minutes after Teixeira bagged his second with a cool finish, although Benitez's side held on for victory.