Mallorca enjoyed the bulk of possession in the first period, but it was the hosts who created the better chances - Jose Manuel Casado firing wide after a good run in behind the Mallorca defence and then hitting the bar with a cross that deceived Dudu Aouate.
The visitors went in front 12 minutes into the second half, though, as Ramis rose to power home Chori Castro's free-kick.
Rayo threw players forward in search of an equaliser but it was Mallorca who should have scored again late on as Victor Casadesus ran through on goal only to flash his shot over the bar.
Both managers were forced into fielding makeshift defences as Jordi Figueras had left Rayo for Club Brugge this week, while Mallorca were missing the suspended Pau Cendros. The change seemed to affect the away team more as it was Rayo who posed the greater threat in the first half.
Aouate was called into action as early as the 11th minute as he got out well to block Piti's shot with his legs.
Marvin Ogunjimi then came close to getting his first goal for Mallorca but his header at the back post crept just wide.
Most of Rayo's good play was coming down the left side and in particular from Casado, but Jose Ramon Sandoval may have wished for the ball to have fallen to a more composed finisher when the left-back was played in 10 minutes before half-time as he smashed his shot into the side-netting.
Casado inadvertently came even closer eight minutes later as his cross sailed over Aouate and back off the crossbar before Michu headed just wide as Rayo ended the half on a high.
However, they were undone after the interval as Castro's excellent delivery from the right was headed in off the bar by Ramis for his second goal of the season.
Sandoval threw caution to the wind in the latter stages as he introduced Andrija Delibasic and Rayco from the bench, but the Mallorca defence stood firm and the Islanders should have made sure of the points in stoppage time but Victor wastefully shot over when one on one with Dani Gimenez.