Santiago Solari tasted victory in his first La Liga match in charge of Real Madrid but he had 18-year-old Vinicius Junior to thank for their 2-0 win over Real Valladolid on Saturday.
Solari threw Vinicius on with the score goalless and tension building at the Santiago Bernabeu but the striker delivered, before Sergio Ramos' late penalty gave the scoreline a deceptively comfortable look.
Madrid's day might have been even better had Rayo Vallecano seen out the 2-1 lead they enjoyed over Barcelona with four minutes left at Vallecas.
Instead, Ousmane Dembele and Luis Suarez scored for Barca in the 87th and 89th minutes to pull off a remarkable comeback, in the absence of Lionel Messi.
It means Ernesto Valverde's side sit four points clear at the top of La Liga, seven ahead of Real and now four up on Atletico Madrid, who were held to a 1-1 draw by Leganes.
For Real and Solari, victory was all-important. Their opener in the 83rd minute was an own-goal, deflected off Kiko Olivas, but prompted by Vinicius' weaving run and shot, the kind of exuberance Madrid's toothless attack has been so bereft of in recent weeks.
Vinicius celebrated by running over to the bench and hugging Solari. He knows the youngster better than anyone at the club, having managed him with Castilla this season.
Previous coach Julen Lopetegui had, understandably, decided Madrid's B team was the best place for Vinicius to settle but with every chance missed, the youngster's reputation has swelled.
Lopetegui had repeatedly bemoaned a lack of luck too during his bad run and even that appeared to turn in Solari's favour. Vinicius' shot cannoned in off Olivas between Valladolid twice hitting the crossbar and Karim Benzema winning a dubious late penalty.
"When the ball won't go in you have to keep calm," Ramos said. "You have to ignore the uncertainty that is created. Finally, we have a positive result for our confidence."
There were whistles at half-time from the home crowd, and during the second half as well, but cheers, perhaps of relief, at the end.
Gareth Bale was not on the pitch to hear them after he had been replaced in the 71st minute with the team still searching for a goal.
'Not a Bunch of Kids'
Madrid, however, head into Wednesday's Champions League game against Viktoria Plzen with their first win in six league games, as well as their own confidence boosted and their coach's momentum enhanced.
"This is an experienced group, not a bunch of kids," Solari said. "They have found themselves too."
Madrid might have held little hope of reducing the gap on Barcelona this weekend but 19th-placed Rayo Vallecano came within a whisker of doing them a favour.
Jose Angel Pozo cancelled out Suarez's opener with a bending shot inside the post and then Alvaro Garcia put the home side ahead, tapping in from a yard within a minute of coming on as a substitute.
Rayo's fans believed but so did Barca, and when Dembele, also on off the bench, curved his shot in with three minutes left, there was still time for a winner.
Suarez grabbed it, pouncing for his sixth goal in four games, a brilliant run of form and just at the right time, while Messi recovers from his broken arm.
Valverde said Messi would be assessed ahead of Tuesday's Champions League game away to Inter Milan. He praised Suarez too.
"Suarez has been getting better and better for a long time," Valverde said. "Now he's getting more goals and now he's scoring them when we also need them most. We are delighted."
Earlier, Antoine Griezmann scored a sumptuous free-kick but Atletico Madrid missed the chance to go top for a few hours after drawing at struggling Leganes.
Griezmann's bending effort in the second half looked likely to prove the difference in a contest short on chances at Butarque but Guido Carrillo's 82nd-minute equaliser earned Leganes a deserved point.
"We played for more and wanted more but have to settle for a point," Diego Simeone said.
"The feeling is bitter-sweet," added Saul Niguez. "We know it is in these matches where the league is decided. Leganes played a great first half but we have to be more ambitious and should have won."