United now face a tricky playoff against one of the sides dropping down to the Europa League from the Champions League in February with Barcelona and Juventus potential opponents.
Alejandro Garnacho scored the only goal of the night at the Reale Arena after just 17 minutes to surpass George Best as United's youngest ever non-English scorer in Europe at 18.
But the Red Devils were left to rue their defeat to the Spaniards at Old Trafford on matchday one as they missed out on topping the group on goal difference.
"You don't always get what you deserve - that's football," said United manager Erik Ten Hag.
"We win today but of course we are disappointed we didn't score two goals because that is what we needed."