A stunning header from Aritz Aduriz shortly before half time was enough to win the day for an organized and impressive Bilbao.
Real piled on the pressure for much of the second half but couldn't find a way past a staunch opponent despite finishing the match with four strikers on the park.
Gareth Bale struck a post with an extraordinary shot from close to the halfway line as full time approached while Arduriz almost doubled Bilbao's lead with another headed chance late on.
The result means second placed Barca can now take top spot should it win at home to mid-table Rayo Vallecano Sunday.
Of more immediate concern to Real boss Carlo Ancelotti after the game, however, was his side's lack of cutting edge.
"I think the problem we are having at the moment is quite clear," Ancelotti told reporters.
"We are not finding a way through like we did in the games before. We've only scored one goal, from a penalty, in two games.
"That is the problem we have to fix. We lack efficiency up front."
Real are now without a win in two league games while the 4-0 February hammering at the hands of city rivals Atletico Madrid, the clubs biggest derby defeat since 1947, is still fresh in the memory.
With the second El Classico fixture of the season against Barcelona only a fortnight away, Ancelotti is looking for a quick fix to his side's attacking inhibitions.
However, such worries are of little concern to a Bilbao side celebrating its first win over Real in five years.
After a slow start to the season the Basques are now up to eighth position.
"We are very proud of how hard we worked," goalscorer Arduriz said in comments carried by the AFP news agency. "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."
Bayern boss Bundesliga
Bayern Munich continued its seemingly inexorable march to a third consecutive Bundesliga title with a come from behind 3-1 victory away to Hannover.
Hiroshi Kiyotake gave the hosts a surprise lead after 25 minutes but Xabi Alonso levelled shortly after.
A second half brace from Thomas Muller ensured the Bavarians would increase their league at the top of the Bundesliga to 11 points as second place Wolfsburg fell to a 1-0 defeat at Augsburg.
Elsewhere Saturday, Borussia Dortmund's winning streak came to an end with as Jurgen Klopp's revitalized side were held to a 0-0 draw with Hamburg.
PSG go top
Paris Saint Germain returned to the top of the Ligue 1 table, for 24 hours at least, with a convincing 4-1 win over Lens at the Parc de Princes.
David Luiz opened the scoring as the first half came to a close before Zlatan Ibrahimovic doubled the Parisian's advantage from the penalty spot on the hour mark.
Substitutes Blaise Matuidi and Javier Pastore secured the win after Yoann Touzghar had pulled one back deficit for Lens.
Lyon will return to the Ligue 1 summit should it dispose of Montpelier Sunday.