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.

Raphinha scores his 100th Barca goal in victory over Celta Vigo
Isack Hadjar takes first F1 pole at Abu Dhabi Grand Prix
Man Utd finally end winless run after fans' protest delays kickoff
Chelsea outclass Liverpool 3-0 to lift gloom
Norris fastest in final practice session of the F1 season
