Real Madrid lost for the first time in La Liga this season as Rayo Vallecano came from behind to beat them.
Santi Comesana put Rayo in front early on but Luka Modric’s penalty and an Eder Militao header meant Real led 2-1 before Alvaro Garcia made it 2-2.
Rayo’s Oscar Trejo then had a second-half penalty saved, but it had to be retaken as goalkeeper Thibaut Courtois had come off his line too early.
Trejo scored second time around to claim victory for Rayo.
Defeat meant La Liga and European champions Real missed the chance to return to the top of the table ahead of Barcelona, who remain two points clear after their 2-0 win at Almeria on Saturday.
Rayo move up to eighth and just two points outside the European places after a third successive victory.
A thrilling encounter featured 31 efforts at goal, though Real only managed two shots on target – with one particularly wild effort from Federico Valverde sailing out of the stadium and into the balcony of a nearby apartment.
An ill-tempered match also featured nine bookings and a red card for Rayo manager Andoni Iraola, who was dismissed for improper conduct following several outbursts at the referee.
“I wasn’t surprised because we all know how they play. They were better and more precise than us today and it’s a well-deserved win for them,” said Real manager Carlo Ancelotti.
“We lost too many challenges. They were overwhelming. It doesn’t matter if you have more quality if your rivals have more intensity than you.
“I think we started the season well but the team has felt the exhausting schedule ahead of the World Cup.”