Third-division Cornella were rewarded for knocking Liga leaders Atletico Madrid out of the Spanish Cup with a home game against Barcelona in the round-of-16 draw on Friday.
Cornella beat Atletico 1-0 at home on Wednesday with a seventh minute goal by Adrian Jimenez.
Barcelona and the other three teams competing in the Spanish Super Cup next week, Real Madrid, Athletic Bilbao and Real Sociedad, will be making their first appearances in the cup this season.
Real Madrid have also been paired with a team from Segunda B, Alcoyano, who eliminated top-flight stragglers Huesca 2-1 on Thursday.
Bilbao will travel to third-tier Ibiza who crushed top-flight Celta Vigo 5-2 while Real Sociedad will visit Cordoba.
All 16 ties, which will be played January 16-21, pair a team from La Liga with a club from a lower division, with the sides from the top division playing away.