Elche went in at the break a goal to the good thanks to Lucas Boye’s effort three minutes before the half-time break.
It added insult to injury to Madrid given Karim Benzema missed the first penalty kick of his career nine minutes before the goal.
Elche then scored their second of the afternoon through Pere Milla in the 76th minute but Madrid pulled one back six minutes later when Luka Modric converted from a spot kick and then equalised through Eder Militao in stoppage time.
The result means that Madrid are now four points clear of second-placed Sevilla at the top of the table with the same number of games played.
Madrid travel to the Basque Country next to lock horns with Athletic Club in the quarter-final of the Copa del Rey before hosting Granada at the Santiago Bernabeu in La Liga.
Elche host Deportivo Alaves as the Martinez Valero next before travelling to Andalusia to take on Sevilla at the Sanchez-Pizjuan.
“Now comes the most important period of the season, where titles are won. And we’re well positioned in La Liga as well as the Champions League and the Copa [del Rey].
“But it was a crazy matchday because Sevilla equalised in the last minute and Atletico [Madrid] also won right at the buzzer. It’s clear that it’s a very competitive league.”