Leaders Barcelona suffered their first defeat in La Liga this season when Real Sociedad stormed back from two-goals down and made the most of a red card for Gerard Pique to record a 3-2 home win on Saturday.
Imanol Agirretxe stunned the visitors by sliding in to grab a last-gasp winner after a double from Gonzalo Castro, who scored either side of halftime, helped cancel out early goals for the visitors from Lionel Messi and Pedro.
A full-strength Barca had dominated the first half, but Pique's second yellow card in the 56th minute came when Sociedad were in the ascendancy, and the hosts were eventually rewarded for their endeavour in time added on.
Barca, who had won every league game except for a 2-2 draw at home to champions Real Madrid in October, stayed on 55 points from 20 games, 11 ahead of second-placed Atletico Madrid.
Atletico host Levante on Sunday when Real, 18 points off the pace in third, visit Valencia.
"I have to congratulate Real Sociedad. Their victory is more to do with how well they played than my players not playing well," Barca coach Tito Vilanova told a news conference.
In the late game, Malaga goalkeeper Willy Caballero saved a point for his side by denying Enrique De Lucas in a one-on-one in the last minute as they held on for a 1-1 draw at home to Celta Vigo.
RAYO HALTED
But Celta's Augusto Fernandez pounced on a loose ball to fire home the equaliser in the 76th and leave Malaga fifth with 32 points.
Rayo Vallecano's impressive surge up the table was halted when they lost 2-0 at Granada and missed a chance to consolidate their position in the European qualifying places.
Granada took the lead when Rayo defender Jordi Amat turned the ball into his own net under pressure from Odion Ighalo in the 24th, and Recio completed only their second home win of the campaign with a low shot 10 minutes from time.
Rayo stayed sixth with 31 points, while Sociedad's victory left them ninth with 29.
Getafe are 10th with 26 points after a 1-1 home draw with Sevilla on Unai Emery's league debut at the helm for the Andalusians.
Barcelona's World Player of the Year Messi had already fired wide in a one-on-one with the keeper when he stroked in his 29th league goal this season from the edge of the area in the seventh minute at Anoeta.
Messi has now scored in 10 consecutive league games to match the La Liga record set by fellow Barca players Mariano Martin in the 1942/43 campaign and Brazil's Ronaldo in 1996/97.
Pedro lashed a shot against the post and in the 18th minute the referee had to stop the match and ask both captains if they were happy to continue after a partial floodlight failure.
MESSI LOB
The game resumed and Dani Alves crossed low for Pedro to slide in and notch Barca's second in the 25th before a Messi lob bounced against the post and was cleared from the goalmouth.
"The key moment was when Messi's shot stayed on the line. At 3-0 it would have been game over," Vilanova added.
Sociedad had given Real Madrid a scare at the Bernabeu two weeks ago before losing 4-3 and the pressure they put on Barca started to unsettle the visitors before the break when Castro fired low into the far corner after 40 minutes.
Keepers Claudio Bravo and Victor Valdes, in the spotlight after saying he would not renew his Barcelona contract when it runs out in 2014, made fine saves but the game was blown wide open when Pique collected his second yellow card.
"They got back into the game with a goal, and it all changed with the sending off," said Vilanova.
Barcelona were struggling to break out of their own half and after failing to clear a corner Castro's shot deflected off substitute Javier Mascherano and past Valdes in the 62nd.
Barca appeared to have weathered the storm as they took control of possession, but the outstanding Carlos Martinez swung in a teasing cross at the end, and Agirretxe got between the central defenders to poke in the decider.
Photograph: Vincent West / Reuters
King's Cup: Barcelona held to 2-2 draw by 10-man Malaga
La Liga: Record for Barca as they march on at Malaga
Pix: Pedro treble in Spain win, Russia stun Portugal
Former Barca coach Guardiola wants to manage EPL club
La Liga: Barca see off Sociedad to keep pace with Real