United's 73m summer signing had become a strangely sidelined figure under Ole Gunnar Solskjaer but capped a stellar showing with a stunning strike to send the Reds into the knockout stage as group winners after a 3-3 draw between Atalanta and Young Boys in the other Group F game. United face the Swiss side - who are out - at Old Trafford on Matchday Six next month.
Carrick - in caretaker charge following Solskjaer's sacking on Sunday - made four changes from Ole's last selection, the 4-1 thumping at Watford. Alex Telles, Fred, Donny van de Beek and Anthony Martial were brought into the team in place of Luke Shaw, Nemanja Matic, Bruno Fernandes and Marcus Rashford with the latter two perhaps surprisingly named on the bench. Martial and David de Gea were the only two survivors in the XI from Solskjaer's first game at Cardiff almost three years ago.
Scott McTominay headed into the side netting from a telling Telles cross, before de Gea was called into action to keep out Moi Gomez. Pau Torres and Yeremi Pino fired narrowly off target in a bright start for Unai Emery's side.
United were again indebted to the in-form Spanish stopper, one of the few players who emerges from the carnage with his head held high. A long kick forward from opposite number Geronimo Rulli dropped invitingly for Manu Trigueros, who connected cleanly only for DDG to turn the ball away with a magnificent one-handed stop.
Cristiano Ronaldo had a header held at the other end but Villarreal continued to carve out chances as Dani Parejo flashed a shot over the bar and Gomez went close with a deflected effort from distance. Arnaut Danjuma - the ex-Bournemouth man who caused United so many problems in the first game at Old Trafford - twice narrowly failed to hit the target.
United were again grateful to De Gea for another spectacular save - again from Trigueros - on the hour mark.
A Gomez cross-shot struck Aaron Wan - Bissaka and fell to the Spanish winger inside the box. His shot was goalbound and going in, but De Gea dived low to again claw the ball out and away to safety to preserve parity.
Carrick sensed an opportunity to push for victory and introduced his big hitting substitutes as Fernandes and Rashford entered the fray on 66 minutes.
It did not take long for the Portuguese schemer to get involved in proceedings, as he played a lovely one-two with Sancho and released the England man through on goal. A first United goal looked in the offing for Sancho, but Rulli raced off his line to snuff out the opening with his foot.
Fred flashed wide with a 25-yarder but, when the deadlock was broken, it came from a much more likely source. With 12 minutes left, Rulli tried to play out but Fred pounced to press Etienne Capoue and the loose ball fell to the loitering Ronaldo who did the rest with a superb lobbed finish.
Ronaldo, Mr Champions League himself, continued his record of having found the net in every European tie so far this season with his tenth of the season - including the 95th-minute winner to sink the Yellow Submarines in September.
Capoue tried to atone at the other end but his header was wayward and Ronaldo almost grabbed a second when he nodded wide having seized on Juan Foyth's misdirected header. The two Reds substitutes also could have put the result beyond doubt, but there was still time for the icing on the cake as the fast-finishing Reds applied the coup de grace.
Fred was involved again as he won the ball and moved it on to Rashford. He in turned found Fernandes, who picked out the onrushing Sancho. The travelling Reds - in fine fettle all night - were able to witness the young winger's first goal for their club as he rounded off a sweeping team move with a thumping finish off the bar to put the seal on a magnificent individual performance.
A good win after a difficult few days with a daunting trip to high-flying league leaders Chelsea on the horizon on Sunday.
Overall team performance: 7/10
United Faithful Man of the Match: Jadon Sancho