Ten-man Barcelona needed an injury-time goal to secure a 2-2 draw at Real Betis on Saturday in coach Pep Guardiola's final Primera Division game in charge.
Sergi Busquets got an early goal for the Catalans before they had Dani Alves sent-off early in the second-half.
Ruben Castro took full advantage of the numerical difference to score twice for Betis in the final 20 minutes, leaving Guardiola staring at defeat until Seydou Keita headed in an equaliser in the dying moments.
The departing coach can look back with satisfaction on four seasons in which he has won 13 trophies including three leagues titles before Real Madrid triumphed this season.
His final game will be on May 25 when his side take on Athletic Bilbao in the Spanish Cup final.
Lionel Messi was unable to add to his 50 league goals on a quiet night for the Argentine. Ibrahim Affelay had already missed a good chance a minute before Busquets put Barca ahead on nine minutes, flicking home a near post header from a Xavi corner.
Messi tried from distance on 17 minutes and Xavi went close with a floated free-kick just moments later.
On 31 minutes, full-back Adriano burst into the area and curled a right-footed shot that produced a top draw save from Casto Espinosa in the Betis goal. Then Xavi again went close with a curling free-kick as Barca dominated the first period.
Casto came to Betis' rescue again just after the break saving well from Keita, before Betis burst into life.
Victor Valdes saved at the feet of Ruben Castro before Dani Alves received his marching orders for a second booking after a clumsy foul on Jefferson Montero.
Betis levelled on 70 minutes as Castro chipped Valdes on being sent clear from a long ball out of defence. Four minutes later and Castro made it 16 for the season when he coolly slipped the ball past Valdes after a delightful pass from Benat Etxebarria.
Messi almost levelled when he slammed a free-kick against the post in the final minute, before Keita scored with a powerful header in time added-on to save a point for Guardiola.
In the night's other game, third-placed Valencia slumped to a 1-0 loss at Real Sociedad.
Antoinne Griezmann got the only goal from close-range in the second half after good wing play by Xabi Prieto.
Sociedad captain Mikel Aranburu said goodbye to the home crowd after 14 consecutive seasons in the San Sebastian club's first-team.
It was also the final game for Valencia coach Unai Emery who confirmed this week that he will be coaching Spartak Moscow next season.
Valencia's defeat means that they are the side finishing third with the worst points total - 61 - since the Spanish league moved to a 20-team format in 1987-88.
Ex-player Mauricio Pellegrino will lead Valencia into the Champions League next season.