Real Madrid and Barcelona have both been drawn against fourth-tier opposition in the Copa del Rey third round.
The draw was conducted on Tuesday.
Madrid travel to Arandina CF and Barca are away at UD Barbastro.
UD Barbastro and Arandina CF both play in the Segunda Federacion.
Atlético will travel to CD Lugo, while Osasuna visit CD Castellon.
The one-off knockout ties are scheduled for January 6 and 7, 2024 and the winners will qualify for the round of 16.