Dani Carval was the unlikely match-winner for Real Madrid as a gritty 2-1 victory at Deportivo Alaves took them top of LaLiga on Saturday.
The right-back prodded home at the end of a chaotic 17-minute period at a sodden Mendizorroza that saw the two sides share three second-half goals.
Sergio Ramos scored first, nodding in Toni Kroos' free-kick, then turned villain with a foul on Joselu that allowed Lucas Perez to restore parity from the spot.
Madrid rose to the challenge and restored their advantage three minutes after the equaliser to go three points clear of Barcelona, who visit Atletico Madrid on Sunday.
Eden Hazard's ankle injury opened the door for Gareth Bale to make his first start since October 5 and the winger almost made an early contribution, his deflected header hitting the post in the 10th minute.
Eder Militao was involved in two Alaves penalty shouts either side of that chance, the first resulting in Aleix Vidal being booked for simulation when there appeared to be a slight trip.
The rain intensified after an error-strewn first half and, in the 52nd minute, Madrid raised their level.
Kroos curled an inviting free-kick into the box and Ramos glanced it beyond goalkeeper Pacheco for his fifth goal of the season in all competitions.
It took just 13 minutes for the centre-back to undo his good work.
Ramos raised a hand to Joselu's face in the box and Perez sent Alphonse Areola, chosen ahead of Thibaut Courtois, the wrong way from the resultant spot-kick.
Madrid were tasked with responding and Carvajal delivered the decisive goal in quick fashion, prodding home the winner at point-blank range after Pacheco blocked an Isco header on the line.
Alaves pressed hard for a second leveller but desperate goal-line interventions from Marcelo and Areola in the closing stages denied both Perez and Manu Garcia, before Federico Valverde missed a clear chance for a third in the dying seconds.
What does it mean? Ball back in Barca's court
Madrid knew victory would apply real pressure to Barca ahead of their title rivals' tough trip to the Wanda Metropolitano.
It was far from pretty, but they completed the job against stubborn opponents, something generally regarded as a sign of genuine contenders.
Isco impresses in tough conditions
Madrid needed creativity with Hazard out of action and Isco did his best in unfavourable circumstances.
Persistent rainfall in the second half seemed to affect the touch of most beside the midfielder, who was a positive presence in the attacking third.
Bale well short of brilliant best
Bale was restored to the starting XI despite his sour relationship with supporters and may require Hazard to spend longer on the sidelines if another opportunity is to be forthcoming.
The Wales winger looked off the pace after almost opening the scoring and was replaced in the 67th minute – after Alaves' equaliser, and before Carvajal's winner.
Key Opta Facts
- Perez has scored in five consecutive home LaLiga games, after failing to score in the previous three.
- With eight goals, he is the joint-top Spanish scorer in LaLiga, along with Gerard Moreno and Loren Moron.
- Kroos has been involved in six goals this season (three goals and three assists), only one fewer than he managed last season (seven, one goal and six assists).
Madrid will look to stretch their unbeaten streak to nine games in all competitions when they entertain embattled Espanyol next Saturday, the same day as Alaves' game away to Granada.