Match ends, Rayo Vallecano 2, Real Madrid 3.
Gareth Bale scored twice as Real Madrid came from two goals down to maintain their La Liga title hopes with victory at neighbours Rayo Vallecano.
The home side led 2-0 after 14 minutes, as Adri Embarba touched in Bebe's cross before Miku poked home a second.
Bale headed in a Toni Kroos corner, but Real then lost Karim Benzema to injury.
Lucas Vazquez, Benzema's replacement, headed an equaliser before Bale pounced on an Embarba error to send Real top for at least a couple of hours.
The sight of France forward Benzema hobbling off clutching his thigh three minutes before the interval will have concerned Real manager Zinedine Zidane, with a Champions League semi-final first leg trip to Manchester City to come on Tuesday.
Zidane went into the game without his leading scorer Cristiano Ronaldo, who is a doubt for the City trip after pulling a thigh muscle during Wednesday's 3-0 league victory over Villarreal.
The Real manager left captain Sergio Ramos, as well as midfielders Casemiro and Luka Modric, out of his starting line-up, with one eye on the match in Manchester.
It looked set to backfire after a quarter of an hour, against a Rayo side looking for revenge after being beaten 10-2 at the Bernabeu in December.
Paco Jemez's side, who are battling to avoid relegation to the Segunda Division, were much more of a match for their Madrid neighbours this time, but ultimately ran out of steam.
Embarba struck for the home side after excellent work down the left from former Manchester United forward Bebe, although Miku also deserved credit for a dummy run that drew defender Danilo to the near post to create space for the scorer.
Real's back line looked disorganised, and conceded a second from a corner as Raphael Varane inadvertently flicked the ball on, and Miku turned in the loose ball from six yards.
A fine save from Real keeper Keylor Navas prevented Bebe's 25-yard shot from flying in for a third.
Bale - returning to action following a back injury - began the visitors' recovery 10 minutes before the interval, with Vazquez heading a fine equaliser from Danilo's right-wing cross early in the second half.
The home side were visibly tiring as the final minutes approached, and it was a weary loose pass from Embarba that allowed Bale to sprint away and slot in a winning goal.
- 13Martín Corral
- 17Marín Ruiz
- 4AmayaBooked at 76mins
- 22CrespoBooked at 62mins
- 2Román TrigueroSubstituted forRatat 78'minutesBooked at 83mins
- 21Sánchez RuizBooked at 53minsSubstituted forIturraat 54'minutesBooked at 67mins
- 10TrashorrasBooked at 73mins
- 14HernándezSubstituted forGuerra Rodríguezat 54'minutes
- 23Dias Correia
- 7Fedor Flores
- 5Dorado Ramírez
- 9Contreiras Gonçalves
- 24Guerra Rodríguez
- 25Rodríguez Oterino
- 26Montiel Caballero
- 16KovacicBooked at 66minsSubstituted forRodríguezat 78'minutes
- 9BenzemaSubstituted forVázquezat 42'minutes
- 20Rodríguez RuizSubstituted forModricat 63'minutes
- Alejandro José Hernández Hernández
- Shots on Target
Second Half ends, Rayo Vallecano 2, Real Madrid 3.
Attempt saved. José Ángel Crespo (Rayo Vallecano) header from the centre of the box is saved in the centre of the goal. Assisted by Bebé with a cross.
Offside, Rayo Vallecano. Quini tries a through ball, but Javi Guerra is caught offside.
Lucas Vázquez (Real Madrid) wins a free kick on the right wing.
Foul by Antonio Amaya (Rayo Vallecano).
Isco (Real Madrid) wins a free kick in the defensive half.
Foul by José Ángel Crespo (Rayo Vallecano).
Corner, Rayo Vallecano. Conceded by Raphael Varane.
Attempt blocked. Miku (Rayo Vallecano) right footed shot from the centre of the box is blocked.
Foul by Isco (Real Madrid).
Quini (Rayo Vallecano) wins a free kick in the defensive half.
Pepe (Real Madrid) wins a free kick in the defensive half.
Foul by Miku (Rayo Vallecano).
Lucas Vázquez (Real Madrid) wins a free kick in the defensive half.
Foul by Quini (Rayo Vallecano).
Attempt blocked. Marcelo (Real Madrid) left footed shot from outside the box is blocked. Assisted by Lucas Vázquez.
Foul by Isco (Real Madrid).
Manuel Iturra (Rayo Vallecano) wins a free kick in the defensive half.
Razvan Rat (Rayo Vallecano) is shown the yellow card for a bad foul.