Real Madrid, who lost to Benfica on Wednesday, will play the Portuguese club again in next month's Champions League knockout playoffs, while holders Paris St Germain will face fellow Ligue 1 side Monaco after the draw took place on Friday.
Teams ranked ninth to 24th in the league phase of the Champions League were drawn against each other in two-legged ties to be played between February 17-25.
The winners join the top-eight teams from the league phase in the round of 16.
Benfica keeper Anatoliy Trubin scored in the 98th minute to wrap up a 4-2 win over Real in their final league-phase clash that left the LaLiga side ninth in the table, a point below eighth-placed Manchester City.
French champions PSG finished 11th after failing to win any of their last three league-phase matches, while Monaco were 21st.
Newcastle United will play Azeri side Qarabag, while Atletico Madrid, who finished three points below the top eight, will face Club Brugge.
Borussia Dortmund have been pitted against Atalanta after both teams missed out on a top-eight finish due to back-to-back losses.
Bayer Leverkusen, the other German side in the playoffs, will face Olympiacos again after losing to the Greek champions earlier this month.
Serie A leaders Inter Milan will take on Norwegian team Bodo/Glimt and Juventus will play Turkish side Galatasaray.

Cats By Five wins Al Garhoud Sprint at Meydan
Norris beats Verstappen to top spot in second Abu Dhabi practice
Dubai Racing Club and Fasig-Tipton launch Dubai World Cup Digital Sale
Verstappen fastest in first Abu Dhabi practice
India replace Iyer with KL Rahul as ODI vice-captain
