Substitute Wissam Ben Yedder was the match-winner for the Spanish side, stroking in from inside the area just two minutes after coming on and heading in at the back post from a corner.
After posing little threat in the 0-0 first-leg draw, United again looked second best against the La Liga side, though Marouane Fellaini's thumping strike did draw Sergio Rico into a save and the away goalkeeper kept out Jesse Lingard's low strike.
Romelu Lukaku lashed home from close range with seven minutes remaining, but it proved to be merely a consolation.
United exit the competition along with Tottenham, but Premier League leaders Manchester City and Liverpool progressed to Friday's quarter-final draw. Chelsea can join them if they beat Barcelona on Wednesday.