Real Madrid survived a late scare to see off Cadiz on Thursday night thanks to goals from Eder Militao and Toni Kroos in their final game before the start of the World Cup.
Brazilian Militao headed in before Kroos doubled Real's advantage with a hammered strike from distance, though Lucas Perez's effort fuelled some nervy looks around the Bernabeu.
It means the gap between Real and league leaders Barcelona remains just two points heading.
The opening 45 minutes was peppered with ill-discipline and tired passes. Five bookings were dished out as long-range potshots from Luka Modric and Alfonso Espino narrowly cleared the crossbars.
Again without the injured Karim Benzema in attack, Real were made to wait until the 40th minute before the unmarked Militao nodded in the game's opener from Kroos' exquisite cross.
Real did need shot-stopper Thibaut Courtois to parry a Ruben Sobrino strike from a narrow angle after the winger had run into space.
A wonderful counter attack from Carlo Ancelotti's side should have seen Real double their lead as Federico Valverde played a one-two with Lucas Vazquez after excellent work from Vinicius but his shot deflected over thanks to Isaac Carcelen's block.
Real doubled their lead thanks to a trademark effort from distance from Kroos.
Cadiz couldn't properly clear their lines from a corner and the ball eventually sat up nicely for the former Germany international to hit a half-volley which was too hot for Ledesma to handle.
The opportunity to settle the game came and passed straight past Luka Modric, who embarrassingly failed to make it 3-0 from just outside the six-yard box after Vinicius had scampered clear of Cadiz's defence.
That error was costly as Cadiz fought their way back into the game to yet again deny Real a clean cheet.
Courtois made hard work of Theo Bongonda's shot before reacting to block Alvaro Negredo's follow up. However, there was no stopping Perez, who slightly unnecessarily hit the postage stamp in the top corner from close range to reduce the deficit.
Real closed out the final few minutes to confirm the victory, ensuring they remain in good shape as they chase another league and European double this season.
Real Madrid player ratings
GK: Thibaut Courtois (6); RB: Lucas Vazquez (8), CB: Eder Militao (9), CB: David Alaba (7), LB: Ferland Mendy (8); CM: Luka Modric (8), CM: Aurelien Tchouameni (8), CM: Toni Kroos (9); RW: Federico Valverde (8), ST: Rodrygo (7), LW: Vinicius Junior (8)
Subs: Daniel Ceballos (N/A), Eduardo Camavinga (N/A), Nacho Fernandez (N/A)
Cadiz player ratings
GK: Jeremias Ledesma (6); RB: Isaac Carcelen (6), CB: Fali (6), CB: Juan Cala (6), LB: Alfonso Espino (7); RM: Ivan Alejo (6), CM: Federico San Emeterio (6), CM: Ruben Alcaraz (6), LM: Ruben Sobrino (6); ST: Alex Fernandez (6), ST: Anthony Lozano (6).
Subs: Théo Bongonda (6), Brian Ocampo (5), Lucas Perez (7), Jose Mari (6), Alvaro Negredo (6).