Zinedine Zidane's side are level on 68 points with Barcelona but lead by virtue of a better head-to-head record.
Brazilian Vinicius chipped in a first-half opener and Ramos curled home a brilliant free-kick in the second half.
Mallorca gave a second-half debut to 15-year-old Luka Romero, who became the league's youngest ever player.
Meanwhile, Wales forward Gareth Bale was given a first Real start since February but struggled to make any significant impact, firing a shot in the sixth minute which was kept out by goalkeeper Manolo Reina.
Vinicius' chip high into the net from Luka Modric's lay-off and Ramos' 10th goal of the season via a curling free-kick from the edge of the area gave Real the three points.
They could have had more but former Chelsea forward Eden Hazard curled wide from 25 yards out, and Karim Benzema drove a shot straight at Reina.
Real have seven games remaining and victory in all of them would guarantee their first title since 2017.
Mallorca's defeat keeps them in the relegation zone, three points adrift of safety.