Athletic Bilbao held out with nine men to secure the 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.