Copa del Rey holders Barcelona will kickstart their defence of the title against Segunda Division B side Cultural y Leonesa.
The draw is structured so that all seven La Liga sides involved in European competition face the teams remaining in the last 32 from the lower divisions.
Real Madrid, who last won the competition in 2014, will travel to North Africa to face Melilla, who are based in the Spanish territory while Atletico Madrid will play Catalan side Sant Andreu.
Valencia will take on Ebro while last season’s Sevilla take on minnows Villanovense while Real Betis take on fallen giants Racing Santander and Villarreal travel to Andalusian side Almeria.
Beaten 2017 finalists face an all top-flight tie against Girona while Espanyol take on Segunda side Cadiz, Eibar play Sporting Gijon, Real Valladolid are pitted against Mallorca and Levante take on Galician outfit Lugo.
Other all Primera ties include Huesca travelling to Athletic Club, Leganes playing Rayo Vallecano in an all-Madrid tie while Celta Vigo take on Real Sociedad.
The ties will be played over the dates of 31 October and 5 December 2018.
Copa del Rey Round of 32 draw:
Alaves v Girona
Almeria v Villarreal
Athletic Club Bilbao v Huesca
Cadiz v Espanyol
Celta Vigo v Real Sociedad
Cordoba v Getafe
Cultural Leonesa v Barcelona
Ebro v Valencia
Leganes v Rayo Vallecano
Lugo v Levante
Mallorca v Real Valladolid
Melilla v Real Madrid
Racing Santander v Real Betis
Sant Andreu v Atletico Madrid
Sporting Gijon v Eibar
Villanovense v Sevilla