Athletic Bilbao held out with nine men to secure a first win over Barcelona in four years and carry a 2-1 lead into the second leg of their Copa del Rey last 16 tie on January 11.
Two goals in three first-half minutes from Aritz Aduriz and Inaki Williams put the hosts in command.
Lionel Messi’s fine free-kick halved Barca’s arrears after the break.
And the five-time World Player of the Year was inches away from a precious second away goal when he hit the post with the final kick of the game after Raul Garcia and Ander Iturraspe had been sent-off.
“We struggled at the start,” admitted Barca boss Luis Enrique.
“They used two counter-attacks to put together two good moves and get ahead.
“In the second-half we concentrated more on what we could control, our play, and I think we did enough to deserve more, even taking into account Athletic’s numerical disadvantage.”
Enrique started all three of his star strike force of Messi, Luis Suarez and Neymar despite handing them an extended winter break which meant they only returned to training on Monday after two weeks off.
This is the sixth time Barca and Athletic have been paired together in the Cup in nine seasons, including three finals.
Barca have emerged victorious in all five previous occasions, but Athletic looked well on their way to reversing that run with two excellent goals midway through the first-half.
Firstly, Aduriz stooped unmarked to head home Garcia’s cross and round off a fine team move on 25 minutes.
Then, in the midst of a homage to Athletic defender Yeray Alvarez who was recently diagnosed with testicular cancer, the hosts struck again when Williams smashed home a volley from Aduriz’s neat backheeled layoff.
Alvarez was in the crowd and the club announced earlier on Thursday he will return to training in the next few weeks after undergoing successful surgery.
“I think in the first-half we were much better than them,” Williams told GolTV.
“The referee left us with nine men, but that is football and we have to suffer. We will go to the Camp Nou and do our best to reach the next round.”
The match was then dogged by refereeing controversy as Aduriz escaped unpunished for an elbow on Samuel Umtiti.
Barca were even more incensed in first-half stoppage time when David Fernandez Borbalan somehow failed to point to the spot when Neymar was chopped down by Borja Etxeita.
Andres Iniesta, Sergio Busquets and Jordi Alba were all booked for taking their protests too far, whilst Messi also had to be restrained from confronting Borbalan as the players left the field for half-time.
“The first-half ended in the worst way with a lot of cards on our part and the players upset at what we saw on the field,” added Enrique.
Borbalan did come to Barca’s aid just after the break, though, when he adjudged Messi’s free-kick to have crossed the line despite Gorka Iraizoz’s best efforts in the Athletic goal.
Iraizoz tipped over a dangerously dipping effort from Neymar as the pressure from the visitors built and the home side were reduced to nine men in their efforts to halt the Brazilian.
Garcia and then Iturraspe had few complaints after seeing second yellow cards for late challenges on Neymar.
More Messi magic nearly prevented Barca starting the year with defeat as he danced past two defenders before a desperate saving challenge from Mikel San Jose prevented the Argentine getting a shot off.
And in the dying seconds Messi smashed a loose ball inside the area off the inside of the post.
No side other than Real Madrid has eliminated Barca from the Cup since 2008 and the holders will remain confident of turning the tie around on home soil on Wednesday.