Holders Barcelona face a Copa del Rey round-of-16 tie against Celta Vigo in early January, while Real Madrid and Atletico Madrid will both take on lower-division opposition in Segunda Division side Numancia and third-tier outfit Lleida respectively.
Celta drew 2-2 at Barca's Camp Nou in La Liga last weekend, and eliminated Madrid from the Copa del Rey in last year's quarterfinals, meaning a tough task for Ernesto Valverde's side, who will return from their winter break on either Jan. 2, 3 or 4 at Balaidos.
"The Copa is a competition full of surprises," Barcelona head of institutional relations Guillermo Amor said at the draw. "There are always some. Nobody knows what can happen."
Zinedine Zidane's Madrid side will travel to Soria for the first leg against Numancia, currently fifth in the Segunda Division, with the return game at the Santiago Bernabeu a week later.
— RFEF (@rfef) December 5, 2017
"The Copa is a very nice competition and also very dangerous," Madrid director of institutional relations Emilio Butragueno said. "We need to take on the game very seriously, respecting the competition, and with the maximum concentration for the first leg."
Atletico will also be away for the first leg at Catalan side Lleida -- one of two third-tier teams in the draw -- who made it this far by shocking Real Sociedad in the last round with three second-half goals at Anoeta.
The other round-of-16 ties see third-tier side Formentera facing last season's beaten finalists Alaves, an Andalusian derby as second division Cadiz face Sevilla, Leganes against Villarreal, Las Palmas taking on Valencia and Espanyol meeting Levante.