Argentina forward Angel di Maria ran onto a perfectly timed pass from Karim Benzema to open the scoring in the 72nd minute. Jose Callejon then followed up with a goal in the 89th minute and another in injury time.
The Santiago Bernabeu meanwhile welcomed Denis Cheryshev, who became the first Russian to start a match for Madrid.
In other round of 32 matches, Real Betis, Las Palmas, Cordoba, Osasuna and Malaga also went through.
During the match, sections of the Bernabeu crowd chanted Jose Mourinho's name, although it was unclear if they were doing so in support of the embattled manager or in a mocking fashion.