Following a goalless first half, Vinicius Jr scored 10 minutes after the restart as he converted a pass from Karim Benzema to put Real ahead.
Vinicius Junior was also a key contributor, scoring the opening goal and winning the penalty that Benzema eventually deposited for a 2-0 lead.
Benzema, who scored a hat-trick as Real beat Paris St-Germain 3-1 to seal a 3-2 aggregate win in the Champions League last 16, then scored twice himself.
Real Madrid was holding most of the early possession, but the Mallorca press was high and causing Madrid problems.