Athletic played a man down from the 74th minute, and two men down from the 80th because of red cards in a drama-filled first-leg match in the round of 16.
Aritz Aduriz scored and set up another goal in the first half for Athletic, and Lionel Messi scored for Barcelona from a free kick early in the second half. Messi hit the post from inside the area three minutes into stoppage time, and Paco Alcacer missed the open net off the rebound.
Athletic beat Barcelona for only the third time in 32 matches over the last 10 years.
In that period, Barcelona has beaten Athletic in three Copa del Rey finals, won their last three league matches, and won both legs of their quarterfinal matchup last year.
Also Read
But a draw next week in the second leg at Camp Nou will be enough to send Athletic to the quarterfinals.
"We are happy," Atlhetic coach Ernesto Valverde said. "We earned a small advantage and we will try to maintain it in the second leg."
Messi pulled Barcelona closer by converting a free kick in the 52nd, with the ball just barely crossing the line after a save attempt by Athletic goalkeeper Gorka Iraizoz.
Second yellow cards by midfielders Raul Garcia and Ander Iturraspe reduced Athletic, which had to endure a siege by the visitors.
Athletic's only loss at San Mames this season was against Barcelona in its first home game in the league. Since then, it has won 11 games and drawn one.
Disclaimer: No Business Standard Journalist was involved in creation of this content