La Real safely progressed for the first time since 2003-04, their only previous appearance.
The Spanish side secured an impressive 2-0 win at Lyon in the first leg and Carlos Vela's brace secured the same result in San Sebastian.
Seven-time champions AC Milan overcame PSV Eindhoven to make the group stage for the 11th time in 12 seasons.
Kevin Price-Boateng netted either side of a Mario Balotelli strike to earn the Italian giants a 3-0 win on the night and 4-1 success on aggregate.
Milan were joined in the draw by Czech outfit Viktoria Plzen.
Having beaten Maribor 3-1 in the first leg, Stanislav Tecl's third-minute goal at the Stadion Ljudski vrt was enough to ease through 4-1 on aggregate.
In the evening's early kick-off, Zenit St Petersburg beat Champions League debutants Pacos Ferreira 4-2 to secure safe progress.
The Russian side won the first leg 4-1 in Portugal and never looked in any danger, especially after Danny goals either side of half-time.
Aleksandr Bukharov further extended Zenit's lead, before Manuel Jose and Carlao struck either side of an Andrey Arshavin penalty as the tie ended 8-3 on aggregate.