Madrid: 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 La Liga game in charge. (Agencies)
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.
"I have no idea what memories I leave the league with. I hope they are good ones that last a long time," said Guardiola.
"But I don't think the league will miss me too much, it was here before me and will continue after me."
On the dismissal of Alves and the Brazilian defender's future at the club, Guardiola was more forthcoming.
"After Dani's red card it was a different game and we lost control a bit as it's hard to play with 10 men," said the Barca boss.
"Dani's future at the club does not depend on me, but in my opinion he is irreplaceable. Not many players can do what he does and I hope he remains as important to the club in the coming years."
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 they finish the season with a record low number of points for a third-placed team.
Their tally of just 61 points -- 30 behind Barca -- is the lowest 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.
Madrid: 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 La Liga game in charge.