Sergio Ramos scored the 100th goal of his career as Real Madrid battled to a 3-0 home win over Leganes in the first leg of their Copa del Rey last-16 tie.
Madrid, beaten 2-0 at home by Real Sociedad in LaLiga on Sunday, were again unconvincing for large periods of Wednesday's match at the Santiago Bernabeu but pulled through after the break.
Captain Ramos gave them the lead shortly before half-time with a penalty, taking his tally for club and country to three figures after Alvaro Odriozola was fouled by Gerard Gumbau.
With Leganes tiring in the second period, Lucas Vazquez capitalised on a defensive mistake before Vinicius Junior cushioned in a low volley to put Madrid in a strong position ahead of the second leg.