Barcelona suffered their first Liga defeat in 29 matches by squandering a two-goal lead to lose 3-2 at Real Sociedad.
Goals by Lionel Messi and Pedro put the visitors 2-0 up in the first half, but Chori Castro pulled one back before the break for the hosts.
Gerard Pique's dismissal on 56 minutes changed the face of the game, with Castro soon levelling via a deflection and substitute Imanol Agirretxe prodding home an injury-time winner.
The defeat is Barcelona's first in the league since last April, although alarm bells will not be ringing as they are still 11 points clear of second-placed Atletico Madrid, who play on Sunday.
Sociedad - who also came back from two goals down against Barca last season - stay ninth but close the gap on the teams chasing European places to just one point.
The match started typically for Barca as Messi made up for a sixth-minute miss by slotting home a cool finish immediately afterwards.
Pedro hit the woodwork before doubling the visitors’ lead as he swept home a close-range finish after a fine low cross from Daniel Alves.
Sociedad were barely out of the starting blocks but they did respond, Carlos Martinez unfortunate to see a great effort disallowed when team-mate Asier Illarramendi strayed offside.
Messi could have put Barca out of sight when, on 40 minutes, his lob over a walkabout Claudio Bravo came back off the post; and just seconds later La Real were back in it.
Uruguayan Castro, a summer signing from Mallorca, was picked out by the impressive Carlos Vela but he still had a lot to do on the left side of the box – his solution was a vicious low drive across Victor Valdes and inside the right-hand post.
Two minutes later and he nearly equalised with a fantastic half-volley that Valdes batted away, although Messi almost extended the lead with a brilliant first-time volley of his own, kept out in style by Bravo.
It was as open as you like going into half time, but the indiscipline of Pique reared its head once more to swing the tide in La Real’s favour.
The Spain defender was booked in the first half for petulantly preventing a free-kick – it was not even a quick free-kick as Pique stood for a full four seconds in the way of his opponent.
That needless caution put him on a tightrope, one he failed to traverse when he left the boot in on Vela 10 minutes into the second half.
From that point on Sociedad were in the ascendance, as bounding full-back Martinez and French forward Antoine Griezmann saw efforts blocked before Castro struck again.
There was a great deal of fortune about La Real’s equaliser – Valdes probably would have saved Castro’s effort but for a wicked deflection off Xavier Mascherano – but it was fully deserved.
The hosts were not content with the single point and, with Barca unable to maintain their usual passing and pressing rhythm, it was all La Real in the latter stages.
The Liga leaders thought they had held on too, but just after the referee signalled two minutes of added time the impressive Martinez cut inside on to his weaker left foot before curling a lovely low cross into the six-yard box, which substitute Agirretxe slid in to meet with a simple finish.
There was no time for a Barca comeback – indeed, Valdes prevented Ifran from nabbing a late fourth for the hosts – and Sociedad celebrated a famous victory, although one which probably will not have a great impact on the defending champions’ title hopes.