However, the hosts were left furious with referee Cesar Muniz Fernandez as after failing to show Sergio Ramos a second yellow card for a clear bodycheck on Coro in the first-half, he pointed to the spot in the fourth minute of added time when Pepe fell to the ground under pressure from Carlos Sanchez.
Ronaldo had put the visitors ahead from a free-kick early in the second-half, but Richmond Boakye thought he had rescued a point when he headed home in the 91st minute before the late drama.
And Real boss Carlo Ancelotti admitted that he was far from satisfied with a lacklustre display from his side.
“I am not happy, we need to play differently,” he told a press conference.
“We didn’t control the game in the second-half after Ronaldo’s goal and it is obvious that I am not happy with the game. The result doesn’t suffice, we need to play better.
“They played well. they were compact and they deserved to equalise because they finished the game very well.”
Elche had also started the brighter side and Real had goalkeeper Diego Lopez to thank for preventing his side from falling behind for the fourth time in six league matches this season.
David Lomban was first to be denied by Lopez as he parried the defender’s header from Eduardo Albacar’s cross before Carles Gil’s low drive was also smothered by the keeper.
Javi Marquez also fired wastefully over as the hosts continued to press and they were rightfully infuriated when Fernandez awarded a foul when Ramos chopped down Coro but didn’t show the Spanish international the 18th red card of his career.
Madrid started the second period with more purpose and were rewarded just six minutes after the restart when Ronaldo’s free-kick bounced just in front of Manu Herrera and he could only help it on its way into the net.
Having gone in front though, Madrid took their foot off the gas and were finally punished in stoppage time when Elche produced their best move of the match to equalise.
A long ball from Herrera was headed into the path of Fidel and his cross was expertly nodded home at the near post by Boakye.
However, the drama didn't end there as having signalled for there to be three minutes of added time, Fernandez allowed a Madrid corner to be taken well into the 94th minute and then pointed to the spot when Pepe hit the ground.
After a number of Elche players had been booked for protesting, Ronaldo kept his cool and drilled the ball low into the corner to earn his side a precious three points.
Ancelotti though is well aware that Real will need to up their game substantially if they are to emerge victorious from the Madrid derby with joint leaders Atletico on Saturday.
"Obviously playing like this we are not going to win the derby. We need to play with more intensity and personality."
In the night’s earlier matches, Sevilla moved off the bottom of the table as they beat Rayo Vallecano 4-1 to secure their first victory of the season.
Ivan Rakitic and Carlos Bacca each scored twice for the hosts with Adrian Gonzalez netting for Rayo, who also had Alejandro Galvez and Jonathan Viera sent off.
And Valencia’s mini revival continued as Jonas Goncalves struck with virtually the last kick of the game to hand them a 1-0 win at Granada and move Miroslav Djukic’s men up to seventh.