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.