Aritz Aduriz scored the only goal of the game midway through the first-half with a thumping header from Mikel Rico's cross yesterday.
The visitors improved after the break, but couldn't find a way past Gorka Iraizoz as Athletic recorded their first victory over the European champions in five years.
Madrid's third defeat in 11 league games means that Barcelona can move one point clear at the top of the table with victory over Rayo Vallecano on Sunday.
"I think the problem we are having at the moment is quite clear," said Madrid boss Carlo Ancelotti.
More From This Section
"That is the problem we have to fix. We lack efficiency up front."
Athletic came into the game on a high having qualified for the Copa del Rey final in midweek, where they will meet Barcelona for the third time in seven years.
And the hosts went in front on 26 minutes when a lovely team move ended with Aduriz powering home a wonderful header from Mikel Rico's floated cross.
"We are very proud of how hard we worked. The three points will prove a huge boost. The fans have enjoyed it a lot and they deserved that after the poor performances at San Mames earlier in the season.