The visitors were without a number of first-team regulars and were punished for a slow start when Natxo Insa prodded home from close range to put Celta in front seven minutes before half-time.
The lead only lasted five minutes though as Messi released Cristian Tello to curl home a fine equaliser and the roles were reversed 18 minutes from time when Tello cut the ball back for Messi to drill low into the net.
The goal was Messi's 43rd league goal of the campaign and also secured another record for the World Player of the Year.
By scoring for the 19th straight game, he became the first player to score against every other side in the Spanish league in consecutive matches.
However, Celta gave their chances of survival a huge boost as Oubina headed home Fabian Orellana's cross at the back post two minutes from time.
And Barca assistant manager Jordi Roura admitted that his side lacked the concentration required to see the game out.
"I don't want to point out individual errors," said Roura, whose team are still 13 points ahead at the top of La Liga after Real Madrid were held 1-1 by Real Zaragoza.
"We had done the most difficult bit which was to score. In the final few minutes we lacked the collective intensity needed and they have equalised."
Despite his disappointment at the outcome though, Roura did take time to laud another incredible individual achievement by Messi.
"It is a unheard of record that no one has ever achieved. This shows how great this player is. With time, what this player is doing will be valued even more."
Second-placed Real Madrid failed to take advantage of Barca's slip-up as they could only manage a 1-1 draw with Real Zaragoza.
Rodri put the hosts in front after just five minutes before Cristiano Ronaldo equalised seven minutes before half-time.
However, manager Jose Mourinho dismissed suggestions that his side had missed an opportunity to get back into the title race.
"For some time our ambition has not been to win the title again," he told a press conference.
"We already knew that it is a question of points, not of winning it. With the draw today we have lost second place. If Atletico (Madrid) win tomorrow, they will go one point ahead and this is the most important thing."
The Portuguese also stressed that his side's league form should not affect their return to Champions League action on Wednesday.
"This result will not affect us. Our objectives are the final of the cup and the Champions League. In the league we have already achieved finishing amongst the top three and our objective is to finish second and win every game. It will not have any influence looking ahead to Wednesday."
With the return to Champions League action against Galatasary in mind, Mourinho rested the midfield quartet of Xabi Alonso, Sami Khedira, Mesut Ozil and Angel Di Maria from the start and the visitors were made to suffer by an energetic Zaragoza side early on.
Rodri fired the hosts into the lead after Apono pounced on a loose ball in midfield and set the former Barcelona man free in behind the Madrid defence where he finished calmly beyond Lopez.
However, Madrid then began to take a hold on the game and after Glenn Loovens' clearance off his own line had denied Pepe, Ronaldo registered his 28th league goal of the campaign with a powerful left-footed shot.
Earlier in the day Malaga moved level with Real Sociedad in fourth as a goal and two assists on his first league start with the club from Pedro Morales guided them to a 3-1 win over Rayo Vallecano.