Seydou Keita's injury-time equaliser ensured Pep Guardiola's final La Liga game as Barcelonacoach was not marked by defeat as his side drew 2-2 at Real Betis.
Sergio Busquets put Barça ahead in the ninth minute of a first half they dominated but Betis responded well in the second period and they took advantage of Dani Alves' sending-off in the 53rd minute.
The impressive Ruben Castro scored two sublime goals in three minutes and Betis were on course for victory before Keita headed home 90 seconds into injury time.
Barcelona had the first real effort of the match in the sixth minute when Pedro took on two defenders and cut in before drilling a low shot from the right of the area which Espinosa Casto got down to gather.
But there was nothing he could do when the visitors went ahead in the ninth minute. Xavi sent in a corner which was met by Busquets, who lost his marker, glancing a header back across the goalkeeper and into the far corner for his first league goal of the season, although the Betis defending was poor.
Xavi was inches wide with a curling free-kick and Adriano forced Casto to parry the ball away for a corner after unleashing a right-footed shot from the left-hand side of the area.
Somehow Guardiola's side led solely by a single goal at half-time and upon the restart Betis showed more attacking verve than in the entire first 45 minutes.
Castro was dispossessed by Javier Mascherano just as he was about to shoot before the hosts failed to take advantage of a goalmouth scramble.
Victor Valdes then dived at the feet of Castro after he had burst into the area and shortly after Alves was shown his second yellow card for a lunge on Jefferson Montero, leaving the visitors to play for almost 40 minutes with ten men.
Castro puts Betis aheadIgnacio Perez Nacho's cross from the left of the area was deflected against Valdes, who was able to clear the ball, but finally Betis forced an equaliser through Castro with 20 minutes remaining.
Roque Santa Cruz flicked the ball on and with Castro having timed his run perfectly, he found himself through on goal and showed great composure, lobbing the onrushing Valdes at the right-hand side of the area.
Three minutes later and Betis were ahead thanks to another superb Castro finish. Etxebarria Benat played the ball through to find Castro unmarked and in a one-on-one with Valdes, with the striker slotting firmly past the keeper from outside the area.
With seconds of normal time remaining, Lionel Messi's long-range free-kick hit the post with Casto beaten. However, with roughly 90 seconds of stoppage time left, Martin Montoya's cross from the right was met by Keita and he powered home a headed equaliser to ensure Guardiola's final league match was not ruined by defeat.