An unconvincing Real Madrid needed a controversial Cristiano Ronaldo penalty deep into stoppage time to snatch a 2-1 win at promoted Elche on Wednesday that kept them hard on the heels of La Liga leaders Barcelona and Atletico Madrid.
The Portugal forward smashed home a free kick to put Real ahead in the 51st minute against a plucky Elche side before substitute Richmond Boakye looked to have secured a point when he headed past Diego Lopez in the 91st minute.
There was more drama to come, however, as Real won a final corner and the referee pointed to the penalty spot after Pepe tangled with midfielder Carlos Sanchez in the area.
Television replays showed the pair grappling with each other before tumbling together to the floor and the Elche players' fury with the decision appeared justified.
However, as the match ticked into its 96th minute, Ronaldo calmly struck the ball into the corner for his sixth goal in six matches this term.
"Anyone who watched the game can decide why Madrid won, it's very clear," Elche captain Jose Albacar said in an interview with Spanish television broadcaster Canal Plus.
"We are going away with the feeling that a match has been stolen from us that we could have drawn against a very good team," he added.
Real's late winner was desperately hard on Elche, who created the clearer chances in the first half and refused to throw in the towel even after going behind against a club which dwarfs them in wealth and prestige.
Their entire squad is worth less than half the world record 100 million euros ($135 million) Real paid for Wales winger Gareth Bale this month and their budget of 6 million last season is dwarfed by Real's of more than half a billion.
Post-match coverage was dominated by the late penalty decision and Barca's Spain centre back Gerard Pique joined the debate by posting an ironic comment on Twitter in which he referred to the match as a "comedy film".
Pique's Tweet prompted a scathing response from Real coach Carlo Ancelotti, who told a news conference the Spain international should "focus on playing rather than talking".