Raphael Guerreiro scored a dramatic late winner as Borussia Dortmund won 3-2 at Borussia Monchengladbach in a thrilling Bundesliga encounter to move into the third and final automatic Champions League qualification place.
Dortmund, knocked out of the Champions League by Monaco in midweek, left the league's top scorer Pierre Emerick-Aubameyang on the bench for Saturday's contest.
And it looked as if his services might not be needed when Marco Reus converted a 10th-minute penalty, awarded despite the foul from Mahmoud Dahoud - set to join Dortmund at the end of the season - on Christian Pulisic seeming to take place outside of the area.
But goals either side of half-time for Gladbach turned the game on its head, Lars Stindl's emphatic finish levelling matters before Dortmund captain Marcel Schmelzer turned into his own net, leading Thomas Tuchel to call for Aubameyang.
And 109 seconds after his introduction Aubameyang proved his worth with a superbly taken 27th league goal.
The woodwork agonisingly denied Guerreiro seven minutes from time but he took full advantage of his second opportunity to seal the points, heading in Gonzalo Castro's free-kick to send Dortmund above Hoffenheim and into Wednesday's DFB-Pokal semi-final with Bayern Munich on the back of a victory.
Reus saw an early opportunity to give Dortmund the lead go begging when he headed over in the second minute.
But he made no mistake when given the chance to redeem himself from 12 yards, with fortune on Dortmund's side as Wolfgang Stark pointed to the spot despite the contact between Dahoud and Pulisic appearing to occur outside the box.
Reus made no mistake in coolly dispatching the penalty and only Yann Sommer's reflexes prevented Ousmane Dembele from doubling from close range after he had been played in by Pulisic.
Dortmund suffered a blow when Nuri Sahin was forced off through injury and replaced by Mikel Merino, but they continued to dominate matters thanks largely to Pulisic.
The United States international came to the fore again to set up Reus, whose effort was deflected wide.
For all Dortmund's dominance, they were pegged back two minutes before half-time.
Merino sloppily gave the ball away in his own half and Andre Hahn duly teed up Stindl to lash into the bottom-right corner.
Gladbach carried their momentum into the second half and Roman Burki had to be alert to race off his line and deny Hahn after he had overpowered two Dortmund defenders to get to a loose ball.
But from the resulting corner Gladbach completed the turnaround, Oscar Wendt taking advantage of Dortmund's failure to deal with his first delivery as he powered in a second cross that was diverted beyond Burki by the unfortunate Schmelzer.
Aubameyang was brought on to repair the damage and did so within two minutes of replacing Reus, latching on to Dembele's pass and taking the ball beyond Sommer before brilliantly firing in from a tight angle.
Pulisic and Sven Bender both tested Sommer as Dortmund sought to pull off a turnaround of their own, but they were grateful to Burki for preserving parity, the shot-stopper thwarting substitute Patrick Herrmann.
Guerreiro must have thought his luck was out when he turned smartly inside the box, only to see the ball hit the inside of the right-hand post and roll across the face of goal.
However, the Portugal international did have the final say, glancing into the bottom-right corner to give Dortmund something to celebrate at the end of a tough week.