Real Madrid will face second-division club Zaragoza in the round of 16 of the Copa del Rey, and Barcelona will take on struggling first-division team Leganes (stream all matches live on ESPN+).
Friday's draw also setup a match between defending champion Valencia and third-division club Cultural Leonesa, who eliminated Atletico Madrid on Thursday.
The round of 16 will still be played in single-elimination games for the first time this year, while only the semifinals will be decided with a home-and-away series.
Madrid will play away to Zaragoza, while Barcelona will host Leganes.
There were no restrictions involving the top-flight teams in the draw, except that the the lower-division clubs would get to play at home.
Zaragoza got past top-flight team Mallorca in the round of 32, while relegation-threatened Leganes ousted third-tier club Ebro. Barcelona and Madrid eliminated third-division clubs Ibiza and Unionistas de Salamanca, respectively.
The only other matchup between first-division clubs will be Real Sociedad versus Osasuna.
In other games between first- and second-division clubs, Sevilla will take on Mirandes, Athletic Bilbao will face Tenerife and Villarreal will play against Rayo Vallecano.
Badajoz, the other third-division club in the draw, will host Granada.
Eight first-division teams were eliminated in the round of 32 including Atletico Madrid, Real Betis, Eibar, Celta Vigo, Valladolid, Espanyol, Levante and Mallorca.