The match got off to a slow start, with Endrick's early chance being saved by Leo Roman. However, the hosts took the lead in a shocking turn of events, with Mateu Morey's pass being mishandled by Dani Ceballos, allowing Martin Valjent to score.
Real Madrid's title prospects were already looking slim after their loss to Barcelona last weekend, and failing to respond here would have been a disappointing end to their campaign. Jude Bellingham tried his best to salvage the situation, but his powerful shot was tipped wide by Roman.
Luka Modric's curling effort also met the same fate, but Mallorca's goalkeeper was in top form, making five saves in the first half. Jagoba Arrasate's 500th senior managerial experience had gone well so far, but he knew his side faced an uphill battle to hold the lead.
Modric's punt was just wide, but Real Madrid had to wait until the 68th minute for an equalizer. Modric played a pass forward to Kylian Mbappe, who turned between two defenders and scored clinically inside the near post.
Although Mallorca had been breached, Roman's save count continued to rise, and Mbappe's next effort was cleared off the line by Valjent. Substitute Gonzalo Garcia failed to score from Fran Garcia's cross, but there was one last chance for Madrid.
Following their 26th corner of the game, Jesus Vallejo flicked it on to Jacobo Ramon, who prodded past Roman to keep his side's title hopes alive.
Despite the spirited comeback, which reduced the gap to the top to four points, a win for Barcelona at Espanyol tomorrow night will likely return the title to Catalonia. Mallorca, meanwhile, will be keeping an eye on Rayo Vallecano's match, as the Franjirrojos look likely to deny them a first European qualification in 22 years.