Athletic Bilbao held on with nine-men to surprise Barcelona 2-1 in the first leg of their last-16 Copa del Rey tie on Thursday.
Aritz Aduriz and Inaki Williams had given the hosts a two-goal lead in the first half before Lionel Messi drew a goal back from a free kick just after the break.
But Athletic successfully defended their lead despite having Raul Garcia and Ander Iturraspe both dismissed after each picked up two yellow cards in the second half.
Mikel San Jose headed wide from an early corner, but the best early chance fell to Gerard Pique, who nodded wide from Messi's cross.
Aduriz opened the scoring on 25 minutes by heading home Raul Garcia's cross on the counter-attack.
And it was 2-0 less than four minutes later when Aduriz played in Williams, who unleashed a rocket inside the near post from 14 yards that left Marc-Andre ter Stegen flat-footed.
The visitors twice appealed for penalties in first-half stoppage time, first for a challenge on Neymar and then for one on Luis Suarez, but their calls were dismissed.
There was a flashpoint before half-time when Aduriz appeared to lash out and catch Samuel Umtiti in the throat, and though the Barcelona player needed lengthy treatment, both players ended up with a yellow card for confronting each other after the incident.
Barcelona's first goal came seven minutes into the second half on Messi's remarkable free kick from about 25 yards out. Athletic goalkeeper Gorka Iraizoz pushed it onto the crossbar and thought he had smothered the ball on the line, but the referee ruled that it had indeed crossed.
Garcia became the first Athletic player sent off in the 74th minute after he caught Neymar's heel late.
Barcelona then had a good chance to equalise when Messi walked the ball through defenders in the box, and only a last-ditch sliding tackle from San Jose prevented him from scoring.
Iturraspe was given his marching orders with 10 minutes to play -- Neymar again drawing the foul after minimal contact.
Pressing for an equaliser with a two-man advantage, Barcelona had a corner deep into stoppage time and it fell to Messi, who uncharacteristically struck the inside of the post with the final play of the game.
The second leg takes place at the Camp Nou next Wednesday, when Luis Enrique's holders will have to overturn a deficit if they are to keep alive hopes of a record 29th Copa del Rey crown.