Gareth Bale scored as a much-changed Real Madrid warmed up for Tuesday's Champions League semifinal second leg against Bayern Munich with a 2-1 win over Leganes on Saturday.
Bale bundled Real into an early lead, before Borja Mayoral took advantage of more sloppy defending to make it two before half-time.
Serbian Darko Brasanac gave Leganes hope of a comeback, but Real closed out victory despite struggling in the second half.
Zinedine Zidane's men stay third in the table, one point behind city rivals Atletico who play Alaves on Sunday, when Barcelona can secure the La Liga title if they avoid defeat at Deportivo La Coruna.
Coach Zidane made 10 changes to the starting XI which beat Bayern 2-1 in Wednesday's first leg at the Allianz Arena, with Bale and Karim Benzema returning.
Bale boosted his hopes of a start in the second leg by hooking in a deflected Benzema effort to give Real an eighth-minute lead with his first goal since a double against Las Palmas on March 31.
Daniel Ceballos fired narrowly over, but the soon-to-be deposed league champions doubled their advantage on the stroke of half-time.
Mayoral tapped in from close range after Leganes goalkeeper Pichu Cuellar totally missed a left-wing cross, with offside appeals waved away as defender Unai Bustinza had got a touch to the ball on its way through.
It was the 21-year-old Mayoral's second La Liga goal, having also netted against Real Sociedad back in September.
Leganes grew into the game after the break as Real's thoughts perhaps turned towards Bayern, and Miguel Guerrero wasted an excellent chance to halve the deficit as he headed wide from a Nabil El Zhar cross.
But the away team did pull one back in the 66th minute, as Nordin Amrabat forced his way to the byline and squared for Brasanac to tap in from close range.
Leganes continued to pile on the pressure, with Casilla making a brilliant stop to deny Bustinza.
Leganes defender Gabriel was sent off in injury-time, as Real clung on for the three points after a below-par performance.