Ronald Araújo climbed off the bench to hit a last-gasp winner as Barcelona returned to the top of the La Liga table with a 2-1 success over Girona.
Hansi Flick's side suffered back-to-back defeats before the international break and left it dramatically late to guarantee a return to winning ways against their fellow Catalonians.
Pedri gave the home side the lead with a precision finish but Michel's visitors belied their lowly league position, getting a deserved equaliser through Axel Witsel's stunning overhead kick.
There was a glut of chances to add to the scoring but it was not until deep in the final moment of added time that substitute Araujo instinctively converted to send his side a point above rivals Real Madrid, who play on Sunday at Getafe.