UEFA Champions League: Real Sociedad 0 Bayer Leverkusen 1
The Germans needed to produce a better result at Anoeta than Shakhtar Donetsk could manage away to Manchester United, and they did their bit with a battling away victory.
The Ukrainians' 1-0 defeat in England made sure the job was completed, as Leverkusen progressed as Group A runners-up.
Leverkusen created the first half's better chances as a Gonzalo Castro free-kick hit the post and Simon Rolfes headed over, but Antoine Griezmann was presented with several opportunities of his own to give the Spaniards something to show for their efforts.
After a string of missed chances before the break for both sides, Omer Toprak finally prodded the visitors into the lead four minutes after the restart, while Stefan Kiessling headed against the crossbar.
The hosts attempted to push men forward towards the end as they sought their first home Champions League goal since December 2003, but Leverkusen held firm.
Sociedad coach Jagoba Arrasate made six changes from the team that lost 4-0 to Shakhtar Donetsk in their last European match, with injured duo Claudio Bravo and Inigo Martinez the most notable absentees.
Leverkusen went into the match on the back of a 1-0 win at Borussia Dortmund in the Bundesliga, with coach Sami Hyypia keeping faith with that side.
The hosts were the first to threaten as the in-form Griezmann fired an audacious half-volley just wide from 30 yards in the eighth minute.
Little more than 60 seconds later Leverkusen went close themselves, as Castro’s free-kick came back off Enaut Zubikarai's right-hand post.
Another Castro set-piece wreaked havoc in the 23rd minute. The German's left-wing delivery evaded the Real defence, but Rolfes headed over three yards from goal.
The hosts gradually began to assert control as the half drew to a close, but Griezmann missed the target with a hat-trick of chances before Carlos Vela agonisingly failed to connect with the Frenchman's low cross.
Hyypia showed his intent by replacing midfielder Jens Hegeler with the attack-minded Robbie Kruse at half-time and it did not take the Germans long to take the lead.
Kiessling saw his 49th-minute header tipped over by Zubikarai and from the resulting corner Toprak poked the ball home after the Spaniards had failed to clear their lines.
Leverkusen's second-half gameplan revolved around getting crosses into Kiessling, but he spurned two more chances from Kruse deliveries, hitting the post before being denied by Zubikarai.
Kruse was the source of danger again in the 72nd minute as the Australian's cross was controlled by Son Heung-Min, but the forward smashed his half-volley well over from near the penalty spot.
Leverkusen invited pressure in the final stages, but they retained their lead despite the hosts' late pressure to seal the their progress.