Alvaro Morata scored a lethal hat-trick as Real Madrid won a LaLiga thriller 4-2 at Leganes to leapfrog Barcelona and return to the top of LaLiga.
Madrid raced into a three-goal lead, James Rodriguez striking after 15 minutes before Morata followed up with a quickfire double to reach 10 top-flight goals for the first time in his career.
Close-range strikes from Leganes duo Gabriel Pires and Luciano Neves reduced the deficit to one just after the half-hour mark as the hosts battled back.
But Morata became the first Spanish player to score a league hat-trick for Madrid since Raul achieved the feat in 2009, his header from James' delivery early in the second half taking a huge deflection off Martin Mantovani and ending the match as a contest.
The victory came despite Madrid making nine changes ahead of crucial matches against Atletico Madrid, Bayern Munich and Barca in the weeks ahead, Cristiano Ronaldo and Gareth Bale among the stars rested.
A sixth straight win for Zinedine Zidane's men in all competitions restores their two-point lead over Barca, who beat Sevilla earlier on Wednesday.
Madrid also have a game in hand as they move closer to winning a first league title since 2012. Meanwhile, Leganes' four-match unbeaten run is over, but they remain five points clear of the relegation zone.
Madrid scored three times in eight first-half minutes, James breaking the deadlock with only his third league goal of the season.
Marco Asensio superbly set him up, intercepting Unai Bustinza's pass just inside Leganes' half and outpacing three defenders including Dimitrios Siovas before laying it on a plate to James to finish simply.
Danilo saw his left-footed effort from 20 yards take a slight deflection before hitting the post, but Zidane's men doubled their lead from the resulting corner.
James took it and Nacho's flick-on found Morata at the far post, the striker scoring with an impressive looping header over goalkeeper Iago Herrerin.
And Morata soon scored his second of the match when Mateo Kovacic surged forward and slipped a throughball to the former Juventus striker, who convincingly beat Herrerin with a high first-time finish.
But Leganes fought back, Diego Rico avoiding an offside flag to race clear down the left and see his cutback deflect off Sergio Ramos and into the path of Pires to stretch in and convert his fourth top-flight goal of the season from close range.
And it was 3-2 within 172 seconds, Alexander Szymanowski's corner headed inadvertently towards his own goal by Ramos, allowing Neves to apply the finish from inside the six-yard box.
Only a stunning save by Herrerin kept out Lucas Vazquez when he swept James' cross towards goal, but the fourth goal did arrive for Madrid three minutes into the second half.
James was again involved, clipping in a free-kick from the left, with Morata's header deflecting in off defender Mantovani - who bizarrely had his hands raised - after Herrerin was indecisive in coming off his line.
Substitute Samu Garcia curled a good opening wide for Leganes, but Madrid were looking more comfortable after the break, even though James showed frustration at being taken off for Isco by punching the away dugout.
Man-of-the-match Morata was more gracious when he came off for Mariano in the closing stages and it was the visitors who created the last big chance, Vazquez racing past three defenders only to be denied by Herrerin as his side settled for a two-goal win that sees them take another big step towards league glory.