Skipper Sergio Ramos scored a late penalty clincher as Real Madrid came from behind to win 3-1 at Leganes and ease themselves into third place in La Liga.
But it was holding midfielder Casemiro who shone after being handed a more progressive role in the absence of several of Zinedine Zidane's big names.
The Brazilian started and finished the 29th-minute move from which the Bernabeu giants went 2-1 ahead at the Estadio Butarque.
Defender Unai Bustinza had earlier headed Leganes into a sixth-minute lead in bizarre fashion as he dived to block a clearance, but Lucas Vazquez cancelled out that advantage within five minutes with a smart finish.
Real, who have now scored 16 goals in their last four games, had to hang on as the home side fought for a late equaliser, but managed to do so to claim revenge for their Copa del Rey exit and climb above Valencia, although they still trail leaders Barcelona by 14 points.
Zidane, as he had hinted he may do, rang the changes with Cristiano Ronaldo, Luka Modric, Toni Kroos and Marcelo among those missing. Gareth Bale was included only among the substitutes, and there was also a seat on the bench for the first time for the manager's son Luca.
However, the visitors were behind within six minutes when they failed to deal with Javier Eraso's corner and although goalkeeper Kiko Casilla repelled Bustinza's initial effort, the defender dived in bravely to block Theo's attempted clearance with his head and the ball flew into the net.
The lead lasted just five minutes as Real took advantage of Dimitris Siovas' poor clearance, as Vazquez fired right-footed past Ivan Cuellar after Karim Benzema and Casemiro combined to set him up.
Marco Asensio shot straight at Cuellar after making space for himself with 16 minutes played, before the visitors went ahead in superb style 13 minutes later.
Casemiro picked out Benzema, who turned the ball around the corner to Vazquez. That allowed Vazquez to slide Casemiro into space, and he finished with aplomb.
With Zidane's men having enjoyed a measure of control after the home side's early flurry, Leganes boss Asier Garitano made a double change at the break when he replaced Siovas and midfielder Gerard Gumbau with Martin Mantovani and Ruben Perez.
Ramos' evening took a turn for the worse when he collected his fifth booking of the season after tangling with Nabil El Zhar, a caution which will keep him out of Saturday's clash with Alaves.
Leganes were far from out of the game and they would have been right back in it had Casilla not managed to block striker Claudio Beauvue's close-range effort after he had slid in to meet El Zhar's inviting 64th-minute cross.
But with Bale having been introduced in Benzema's place with 16 minutes remaining, the visitors were posing a greater threat and Isco tested Cuellar with a well-struck effort before Ramos converted a last-minute penalty after Mateo Kovacic had been tripped by Tito.