Midfielder Raul Baena grabbed the winner in the 83rd minute to send the Barcelona-based side into 14th place in La Liga after a third straight home win.
The hosts took the lead through a Simao Sabrosa free-kick in the 17th minute before Mallorca hit back through Giovani Dos Santos and former Espanyol player Javi Marquez to take the lead heading into the break.
Joan Verdu restored parity on 68 from the penalty spot before Mallorca were reduced to 10 men following a second booking for Antonio Luna.
Baena then settled the contest when he fired home a loose ball.
Defeat for Mallorca means they remain in the relegation zone, having won just once in their last 15 attempts.