Antoine Griezmann led Barcelona back from the brink on Wednesday as the Catalans beat Granada 5-3 after extra-time to win a riveting cup tie and reach the Copa del Rey semi-finals.
Barca looked set to crash out at Los Carmenes when Granada led 2-0 with two minutes of normal time remaining but Griezmann scored one goal in the 88th minute and then set up Jordi Alba for a dramatic equaliser in the 92nd.
Griezmann headed his team in front in extra-time only for Granada's Fede Vico to make it 3-3 with a penalty.
Yet Frenkie de Jong's finish and a thumping volley from Alba, also set up by Griezmann, sent a relieved Barcelona through.
"It was a brilliant, beautiful cup tie," said Griezmann.
Ronald Koeman admitted the Copa del Rey is his team's "shortest route" to a trophy this season and with Atletico Madrid 10 points clear in La Liga and Paris Saint-Germain to come in the Champions League, it may prove their only route too.
Granada, though, came within a whisker of another huge upset as goals from Robert Kenedy and Roberto Soldado put them in sight of the last four.
Instead, Koeman's side rallied, with Lionel Messi the architect and Griezmann delivering surely his best performance since he joined Barcelona from Atletico 18 months ago.
It is the kind of performance that could prove a starting point for Koeman's team.
"A match and a result like this will feed our spirit and our strength," said Koeman. "These are moments that can be very important in a season."
Griezmann now has six goals and seven assists in his last nine games.
"Now I need consistency," said Griezmann. "I've felt good since January and I want to keep it going until the end of the season. I feel like I have the confidence of my coach and my teammates."
Barca's reward is a place in the semis and they will be heavy favourites after early exits for Atletico and Real Madrid.
They join Sevilla, who beat Almeria on Tuesday, and Levante, who also came through after extra-time for a surprise 1-0 win against Villarreal.
Real Betis or Athletic Bilbao play on Thursday for the last spot.
Samuel Umtiti was at fault for Granada's opening two goals, first robbed by Alberto Soro, who fired a quick pass across for Kenedy to score, and then outrun by Soldado, who finished into the corner.
Sergi Roberto went off with what looked like a hamstring strain and Barca searched for a way back.
Francisco Trincao and Messi both hit the woodwork while Griezmann drew a smart save from goalkeeper Aaron Escandell with a bicycle kick.
Finally the pressure told in the 88th minute, Griezmann sliding onto Messi's curled pass to the back post and catching it on the bounce, the ball cannoning off the goalkeeper and in.
Granada had four minutes of added time to survive and they held out for only two, a carbon-copy pass from Messi finding Griezmann in the same spot, this time the striker heading across for Alba to nod in.
Luis Suarez could still have won it for Granada in normal time but drove wide when sent clear and it looked like Barca had it wrapped up when Griezmann scored again in extra-time, heading in Alba's cross from the left.
Granada struck back almost immediately, though, Sergino Dest knocking over Carlos Neva in the box and Fede Vico converting the penalty, only for Barcelona to find a fourth. Messi's shot was parried out for De Jong to poach the rebound.
Granada were on the ropes and a fifth proved the knock-out blow. Griezmann swept a superb pass out to Alba, who nonchalantly volleyed in for perhaps the best goal of a thrilling night.