Jens Hegeler's added-time free-kick got Bayer 04 Leverkusen's UEFA Champions League Group A campaign back on track at the expense of Real Sociedad de Fútbol.
In a meeting of two sides beaten a fortnight ago, Simon Rolfes put Leverkusen ahead just before the break, only for Carlos Vela to level shortly after the restart. With Jagoba Arrasate's team making good use of the space allowed by the hosts in the second half, the visitors would have deserved a point but were denied when substitute Hegeler curled his kick majestically into the top left-hand corner.
Amid slick early passing by either side, Leverkusen came close in the third minute when a Son Heung-Min effort from close range was kept out by Claudio Bravo. Although the Bundesliga club registered more shots, both teams refused to go all-out in attack, relying instead on their four or five most advanced players to create danger and keeping the rest back most of the time.
Leverkusen did threaten from distance with a Rolfes shot which Bravo did well to parry. At the other end of the pitch, home custodian Bernd Leno had more problems keeping out a swirling Antoine Griezmann free-kick.
Leno then had to head the ball clear when positioned outside the area and just in front of the lurking Haris Seferovic to prevent the opener. However, team-mate Stefan Kiessling missed the chance to impress watching Germany coach Joachim Löw when he powered into the area and sent his low drive fractionally past the far post.
The sheer willpower of Rolfes was instrumental in the breakthrough moments before half-time. Not surprisingly it came from a set piece, a free-kick delivered by Sidney Sam that Rolfes met with an emphatic header. Bravo made the block, but the Leverkusen captain followed up to force in the rebound.
Shortly after the restart, La Real were level. After Roberto Hilbert felled Vela in the box, the former Arsenal FC striker stepped up himself, failed to beat Leno with a low effort, but tapped in the loose ball for the equaliser.
The game turned into a more open affair now, with first Gorka Elustondo and then Vela going very close to scoring. Leverkusen's full-backs were pushing up higher than before and that in turn afforded La Real the space they so relish, Leno having to hold an Alberto de la Bella effort from promising position. Even so, Robbie Kruse and Kiessling missed great opportunities before Hegeler took charge and scored the unexpected winner.