Vinicius Junior scored a fine solo goal as Real Madrid came from behind to beat Espanyol 3-1 and cut Barcelona's lead to six points at the top of La Liga on Saturday.
Ruben Baraja's Valencia scraped a fraught 1-0 win over Osasuna to climb out of the relegation zone thanks to Justin Kluivert's strike at Mestalla.
Joselu had sent visitors Espanyol ahead early on at the Santiago Bernabeu but Vinicius produced a surging run and lethal finish to pull the champions level.
Eder Militao's header completed the turnaround and Marco Asensio wrapped up the win late on.
"They caught us out a bit with their goal, but the game gives us confidence to face a complicated week," said Nacho, ahead of Madrid's clashes with Liverpool in the Champions League on Wednesday and Barcelona on Sunday.
"When space opens out, we're a team that has very fast players up front (to capitalise)."
After failing to score from open play in their last three matches across all competitions, Madrid's three well-taken goals were a confidence boost.
With Karim Benzema out with an ankle issue, although poised to return for the Champions League last 16 second leg clash with Liverpool, Carlo Ancelotti selected Rodrygo up front.
The coach also opted to play Eduardo Camavinga out of position at left-back again and the French midfielder's mistake helped the visitors move ahead after eight minutes.
Camavinga misjudged a long ball which he allowed to reach Ruben Sanchez, who crossed for striker Joselu to smash into the top corner.
It was the forward's 12th goal of the season. Only Barcelona's Robert Lewandowski has scored more in La Liga, with 15.
Stirred by Espanyol's goal, Madrid quickly improved in the early afternoon spring sun, and Vinicius fired them level with a superb solo effort.
The Brazilian winger cut inside from the left and drove home to net his 19th goal of the season across all competitions.
Militao headed the champions in front before the break, meeting a sumptuous Aurelien Tchouameni cross, which the midfielder served up with the outside of his boot.
Vinicius was in the wars again, knocked to the floor off the ball by Oscar Gil, who was booked.
The forward has been targeted by opposition defenders in recent months and Gil's bodycheck added to his grievances.
Vinicius was booked in the first half for a foul himself, his eighth yellow card of the season.
"Many of these (bookings) have been for protesting, but today, I want to highlight that for me, his attitude was exemplary," said Ancelotti.
"He didn't say anything and he played very well. He has to continue like this, they have given him too many yellows for the kicks that he receives."
Rodrygo came close to extending Madrid's lead when he curled a free-kick over the wall but it struck the crossbar.
Eventually Asensio sealed the win after Nacho Fernandez's uncharacteristic dribble forward set him up.
Defeat leaves Espanyol provisionally 14th, two points above the relegation zone.
"Our game plan is what we did today, to go out there, up for it, don't let the opponent play," Joselu told Movistar.
"We saw Real Madrid shooting from range, we made it hard for them.
"From this game we must take away the great effort we made … this is the path we have to follow."
Valencia moved provisionally to 16th, a point above the drop zone, with their slender win over Osasuna.
Kluivert struck his fourth league goal of the season in the 74th minute to win the game, a well-taken finish after being picked out by Samuel Lino.
After several Valencia penalty appeals, some over-exaggerated, were turned down, eventually the hosts were awarded a spot-kick in stoppage time when Thierry Correia was felled.
However, Herrera saved Hugo Duro's poor low effort down the middle with his feet, leaving the hosts worrying until the bitter end.
"Look at Mestalla today, how beautiful," Kluivert, son of former Barcelona striker Patrick Kluivert, told DAZN.
"I like that. In the week we trained very well and hard, and today you can see, defending and attacking together, with the team, I am very happy."
Iago Aspas struck twice for Celta Vigo, who climbed to 11th after a comfortable 3-0 win over Rayo Vallecano, seventh.
Tete Morente's 96th minute strike snatched bottom-of-the-table Elche a 1-1 draw against Real Valladolid, who finished with nine men.
The visitors had Roque Mesa dismissed after 100 minutes for a second yellow card and Martin Hongla sent off for protesting it.
Elche remain 13 points from safety and have just two wins from their first 25 matches.