Manchester United interim boss Michael Carrick dedicated victory over Villarreal to former manager Ole Gunnar Solskjaer as United booked their place in the Champions League last 16.
Goals from Cristiano Ronaldo and Jadon Sancho gave Carrick a win in his first game in temporary charge two days after Solskjaer was sacked.
“It’s not been an easy couple of days for anyone at the club and that result almost feels like it’s for Ole,” said Carrick, a Champions League winner with United as a player in 2008.
“We had a job to do and things needed to be taken care of. I was happy to do it and thankfully it all went to plan.
“When you’ve suffered results-wise and aren’t in good form, individually and as a team, it’s not easy to come out and let everything click – we had to show some character and fight.”
Ronaldo maintained his record of scoring in every game in this season’s competition when he lifted the ball over goalkeeper Geronimo Rulli in the 78th minute, after Fred had dispossessed Etienne Capoue.
Sancho then sealed the victory in injury time, blasting a shot that went in off the underside of the crossbar.
However, United were indebted to goalkeeper David de Gea as he produced two superb one-handed saves, one in each half, to keep out well-struck efforts from Manu Trigueros when it was goalless.
United will progress as group winners with a game to spare after Atalanta could only draw 3-3 with Young Boys in the later game on Tuesday.