Youngster Alvaro Morata came off the bench to head home a crucial winner as Real Madrid won 2-1 at Levante on Sunday.
He had only been on the pitch for one minute when he guided a Xabi Alonso free-kick home for his first league goal for the club in challenging conditions.
Angel Rodriguez had earlier struck a second-half equaliser to level Cristiano Ronaldo's opener and it seemed Madrid would rue a missed penalty by Alonso.
Morata's 84th minute header was vital for Madrid to stay in touch with both leaders Barcelona and city rivals Atletico Madrid who had won earlier in the day.
The win means Real remain eight points behind Barca who won 4-2 at Mallorca while Atletico remain second, three points behind the leaders, after beating Getafe 2-0 at home.
Jose Mourinho welcomed back Fabio Coentrao to the starting eleven for the first time since late August, allowing Sergio Ramos to move back to the centre of defence after a spell helping out at right-back.
Levante had the brighter opening, carving out a number of chances before Ronaldo opened the scoring.
The Portuguese star had suffered a cut above his eye on 3 minutes after a clash with David Navarro and his team was struggling to come to terms with the wet conditions, with a lot of surface water making the pitch almost unplayable.
However when the ball dropped to him from a defensive clearance on 21 minutes he did not hesitate before thumping a volley home for his twelfth of the season.
With the ball failing to bounce on most parts of the pitch, it was hard for either side to play much football and the conditions affected the amount of clear cut chances made.
There was a surprise at the interval when Ronaldo did not come out for the restart, a consequence of the earlier eye injury, he was replaced by Raul Albiol.
Straight from the kick-off Levante showed their intent with Juanlu hitting a vicious shot from distance that Iker Casillas held onto in the Madrid goal.
Pepe headed a corner onto the bar at the other end and somehow a Sergio Ramos back-heel stayed out of the net from almost on the goal-line.
However Levante were always a danger and the equaliser came on 62 minutes when the substitute Angel beat Pepe to a Obafemi Martins flick before guiding the ball past Casillas.
Ten minutes later Real seemed to have their best chance to win the game with a penalty after Navarro was adjudged to have fouled Jose Callejon in the area.
In the absence of Ronaldo, Alonso stepped up and drove the ball down the centre of the goal gifting Gustavo Munua with an easy save.
Juanlu almost won it for the home side as his shot evaded Casillas before floating just past the post before Morata appeared to score the priceless winner with his first touch.
First-half goals from Adrian Lopez and Arda Turan were enough for Atletico, Adrian Lopez opened the scoring from close range after first seeing his header blocked by Getafe keeper Miguel Angel Moya.
Turan was fortunate not to be penalised for handball before hitting the second just before the interval.
There was no way back for Getafe who played the final twenty minutes with a man less when centre-half Rafa limped off after his side had already made three substitutions.
Earlier Lionel Messi struck twice as leaders Barcelona survived a second-half spell of pressure at Mallorca.
Xavi Hernandez, with a brilliant free-kick, Messi and Cristian Tello got first-half goals for the Catalans before Victor Casadesus and Michael Pereira reduced the lead after the interval.
Messi then hit his fifteenth in the league to wrap up the game and make it 76 goals now in 2012, beating Pele's tally of 75 from 1958 and taking him to within nine of Gerd Muller's all time record total of 85 set in 1972.
Also on Sunday Athletic Bilbao battled to a hard fought 2-1 win over Sevilla despite finishing the game with ten men, while Valladolid and Valencia shared a point each from a 1-1 draw.