A match utterly devoid of excitement looked headed for a goalless draw until Leo Baptistao broke the deadlock with a goal totally out of keeping with what had gone beforehand, firing home low from 30 yards.
He then turned provider as substitute Andrija Delibasic got a second in the 90th minute to keep the hosts well-placed in the top half and condemn the visitors to a seventh defeat in eight La Liga games.
Rayo showed the only attacking intent in the first half, Jose Carlos firing over from the edge of the area and Alejandro Dominguez also sending an attempt too high.
Jose Carlos was the architect of the home side's next opening, sending in an inswinging corner from the right which Piti headed wide.
Mallorca have now taken just one point from a possible 24, having started the season with 14 from 21.
They did at least create a chance late in the first half as Emilio Nsue headed wide from a Giovani Dos Santos corner.
The second half managed to be even more uninspiring than the first as both sides struggled to show any real quality.
But it was Rayo who sealed a barely-deserved victory with two goals in the final three minutes.
Baptistao got the first with a fine long-range effort which found the bottom left corner and then set up Delibasic to convert a low shot from inside the area.