(CNN) -- Barcelona's unbeaten record in La Liga was dramatically ended on Saturday as they slumped to a shock 3-2 defeat at Real Sociedad.
Tito Vilanova's side were two goals up inside the first half hour thanks to strikes from Lionel Messi (7th minute) and Pedro (25th minute) and looked to be on course for another routine three points.
But five minutes before the break, Uruguayan winger Gonzalo Castro halved the deficit and when Barca's Gerard Pique was shown his second yellow card in the 56th minute the home side took full toll of the numerical advantage.
Six minutes later, Castro found the target again to level the scores and to set up a tense finale which concluded in dramatic fashion when striker Imanol Agirretxe stabbed home from close range in injury time.
The defeat brings the curtain down on a sensational run of results for the Catalans who, until Saturday, had amassed 55 points from a possible 57 -- Real Madrid the only team to take points off them this season with a 2-2 draw at the Nou Camp in October.
Second-placed Atletico Madrid can close the gap on Barcelona to eight points if they beat Levante on Sunday.
Elsewhere in La Liga, Getafe and Sevilla drew 1-1 while struggling Granada beat sixth-placed Rayo Vallecano 2-0.
Meanwhile in Serie A, league leaders Juventus recorded an emphatic 4-0 win against Udinese.
Paul Pogba scored two memorable goals as the reigning champions moved five points clear at the top of the table.
The 19-year-old French forward unleashed an unstoppable 35-yard strike in the 41st minute before netting again in the 66th minute with another long-range effort.
Mirko Vucinic added a third six minutes later before substitute Alessandro Matri completed the rout with ten minutes remaining.
Second-placed Lazio, who were also in action on Saturday, could only draw 2-2 away at relegation-threatened Palermo.