Barcelona coach Tito Vilanova was gracious in defeat after Real Sociedad produced an amazing fightback to end the Primera Division leaders' unbeaten record.

Lionel Messi and Pedro Rodriguez had put the visitors two goals up within 25 minutes at the Anoeta, but Gonzalo Castro's brilliant strike gave Sociedad hope before half-time and then, after Barca had lost centre-back Gerard Pique to a red card, Castro's curling effort was deflected into his own net by Barca substitute Javier Mascherano.

That sent the home fans wild, but it got even better in stoppage time when Imanol Agirretxe poked Carlos Martinez's cross from the right past Victor Valdes.

"We congratulate them," said Vilanova, whose side had headed to San Sebastian having dropped only two points in La Liga all term - in a 2-2 Clasico draw with Real Madrid at the Nou Camp in October. "It is more credit to them than due to a fault of ours."

The Catalan giants could have had the game wrapped up before half-time, but both Pedro and Messi were denied by the woodwork, leaving Vilanova to rue the missed chances to put the game to bed.

"I have no reproaches for my players," he said. "In the first half we had control of the game and hit the post twice. (Sociedad goalkeeper Claudio) Bravo has been playing very well - the team had conceded only six goals at home (before kick-off).

"(Even) at 0-2 I never thought it would be an easy match. I know Real Sociedad are a much more intense team than a year ago."

Pique, having been needlessly booked before the break for not retreating 10 yards at a set-piece, paid the price 11 minutes after the restart - with the score at 1-2 - when he was shown a second yellow card for a trip on Carlos Vela.

Vilanova felt Pique was unfortunate to see red.

"Offences like this (the second booking)... there were 200," he added at his post-match press conference.

Barca's loss meant second-placed Atletico Madrid could move within eight points if they beat Levante tomorrow, while third-spotted champions Real Madrid could get within 15 points if they overcome Valencia at the Mestalla.