Iker Muniain scored twice - including an extra-time penalty winner - as Athletic Bilbao knocked Barcelona out of the Copa del Rey in the last 16.
Muniain opened the scoring inside two minutes, before Ferran Torres scored his first Barcelona goal to level in the 20th minute.
Inigo Martinez thought he'd won it only for Pedri to fire in a last-gasp leveller and force extra time.
But Muniain's 105th-minute penalty clinched victory for the hosts.
Defeat deepened the gloom for Barca - sixth in La Liga and enduring a miserable season - with boss Xavi's only realistic hopes of a trophy this season now lying with the Europa League.
Athletic took the lead early on when Nico Williams, younger brother of Athletic winger Inaki, crossed for Muniain, who curled beautifully into the corner past goalkeeper Marc-Andre ter Stegen.
Torres scored a similar goal at the other end 18 minutes later, restoring parity in a pulsating game.
In the 86th minute, Martinez forced Muniain's free-kick over the line via a header from substitute Alex Berenguer, with the goal given after a VAR check for offside.
Berenguer then thought he had made it 3-1, but the goal was ruled out for offside, before Pedri struck for Barca in stoppage time after Dani Alves' overhead assist.
But it only delayed Barcelona's disappointment as Muniain converted from the spot when Jordi Alba was judged to have handled a cross in the area.
- 18De MarcosBooked at 104minsSubstituted forLekueat 105'minutes
- 17BerchicheSubstituted forBalenziagaat 90'minutes
- 30WilliamsSubstituted forZarragaat 110'minutes
- 14García CarrilloBooked at 30mins
- 6VesgaSubstituted forNolaskoainat 117'minutes
- 10MuniainBooked at 120mins
- 8SancetSubstituted forWilliamsat 52'minutesBooked at 119mins
- 22GarcíaSubstituted forBerenguer Remiroat 79'minutes
- 7Berenguer Remiro
- 1ter Stegen
- 8Alves da Silva
- 3PiquéBooked at 76mins
- 18AlbaBooked at 105mins
- 16González LópezBooked at 97minsSubstituted forBraithwaiteat 105+3'minutes
- 30Paez GaviriaSubstituted forde Jongat 61'minutesBooked at 104mins
- 29JutglàSubstituted forFati Vieiraat 61'minutesSubstituted forDestat 96'minutes
- 33EzzalzouliSubstituted forGonzález Iglesiasat 45'minutes
- 6Puig Martí
- 10Fati Vieira
- 13Murara Neto
- 14González Iglesias
- 21de Jong
- 31Balde Martínez
- José Luis Munuera Montero
- Shots on Target