Robert Lewandowski scored in stoppage time to snatch a point off Inter Milan and keep Barcelona alive in the Champions League.
Lewandowski's last-gasp header helped the Catalan club salvage a 3-3 draw the Italians after the visitors had taken a 3-2 lead with a goal from Robin Gosens in the 89th minute.
A loss would have meant elimination for Barcelona for a second consecutive season in the group stage and even the draw means Xavi’s team remain in a difficult situation.
Third-place Barcelona sit on four points, three behind Inter in the fight for second in Group C. Bayern Munich, who beat Viktoria Plzen 4-2 for their fourth victory in a row, are qualified for the last-16 with 12 points.
It would have been the first time since 1999 that the Catalan club had failed to advance to the knockout stage in consecutive years.
Barcelona took the lead from close range after a cross by Sergi Roberto in the 40th minute but Inter rallied with goals from Nicolo Barella and Lautaro Martinez.
Inter's first goal came after Gerard Pique let a ball go over his head as he apparently didn't realise Barella was behind him.
The hosts equalised with Lewandowski in the 82nd minute but Inter moved ahead again through Gosens’ finish on the counter.
Yet there was still time for Barcelona to make it 3-3 as Lewandowski rose highest at the far post to direct a deep cross past Andre Onana in added-on time.