Zinedine Zidane was forced into an early substitution as Jesus Vallejo picked up an injury in the 16th minute and had to be replaced by Nacho.
Raphael Varane could have sent Los Blancos ahead in the 27th minute with a header but he sent his effort well over the crossbar.
The hosts were struggling to find their rhythm after 35 minutes, with Leganes doing well to limit them to only long range shots.
Daniel Carvajal almost broke the deadlock for Real three minutes before the break with a powerful left-footed strike from the right side of the box that could not find the target.
Leganes came out a different side in the second stanza and started playing with more confidence going forward as Naranjo nearly took the lead for visitors with a long range strike that missed narrowly wide in the 56th minute.
Los Blancos' Varane had another opportunity with the header in the 72nd minute but he failed to hit the target from point-blank range.
Zidane made his second change in the last ten minutes by bringing on Isco in place of Marcos Llorente.
Marcos Asensio broke the hearts of the home fans as he scored in second-half stoppage time with a stunning shot to seal a 1-0 win for Los Blancos.