Barcelona fell to their first defeat of the season in the league in the most unlikely of circumstances in Anoeta.
The Catalans took the lead through Leo Messi after just seven minutes and the game looked to be following the familiar pattern of the club's recent results when Pedro slid in to make it 2-0.
But a goal by Chory Castro moments before the half-time break gave Philippe Montanier's men hope, which turned into genuine belief when Gerard Piqué was sent off on 57 minutes for a second bookable offence. Castro equalised not long after Barça were reduced to 10 men and then the hosts went for the winner, which they got in stoppage time as Imanol Agirretxe poked home a cross from Carlos Martínez.
Barcelona were then left with no time at all to look for an equaliser, and sufferred their first defeat in the league since April 2012.