Barcelona title on hold after draw at Bilbao
Victory for Barca at the San Mames and defeat for Real in the Madrid derby at the Calderon would have given the leaders an unassailable 16-point advantage with five matches left.
Real's comeback win meant Barca's lead was cut to 11 points and they also pulled six points clear of Atletico, who are third and almost assured of a Champions League place for next season.
Barca must wait until after their likely elimination from Europe's elite club competition at home to Bayern Munich on Wednesday for another chance to secure a fourth Spanish crown in five years.
"We are leaving with a bitter taste in our mouths but feeling satisfied with the job done," Barca forward Alexis Sanchez, who netted his side's second goal, told reporters.
With an eye on the Champions League semi-final second leg, when Barca need to overturn a 4-0 deficit against the Germans, coach Tito Vilanova initially left league top scorer Lionel Messi and playmaker Andres Iniesta on the bench.
Bilbao, without a home win in six La Liga games against Barca, took a surprise 27th-minute lead when Markel Susaeta finished from close range from an Aritz Aduriz cross.
Barca huffed and puffed in search of an equaliser but were fortunate not to fall 2-0 behind when Susaeta struck a free-kick against the crossbar 10 minutes into the second half.
Only when Argentina forward Messi, who had missed the last three league games with a hamstring strain, came off the bench on the hour did Barca find their cutting edge.
The World Player of the Year brilliantly weaved his way through a crowd of defenders to equalise in the 67th minute and Alexis, who had earlier struck a post, made it 2-1 two minutes later from a Messi assist.
Messi's goal, his 44th in 33 league matches this season, set another record as it took his tally away from home to 24, one more than Real Madrid forward Cristiano Ronaldo got last term.
The Argentine has also scored at least one goal in his last 20 league appearances while Barca equalled their La Liga record by scoring for the 26th consecutive away match.
They looked to have another three points safely in the bag before Bilbao midfielder Ander Herrera rifled a low shot into the corner of the net after 90 minutes to send the home fans into raptures on a wet and chilly night in the Basque Country.
"The Athletic stadium is a very difficult place to play and you saw that as we had the match won," Barca assistant coach Jordi Roura told a news conference.
"We are closing in on our goal bit by bit."
Real Madrid, 4-1 down to Borussia Dortmund after Wednesday's semi-final first leg, also face Champions League elimination but coach Jose Mourinho fielded a second-string side at Atletico.
He was also missing Portuguese compatriot Ronaldo, Real's top league scorer with 31 goals, who damaged a thigh muscle at Dortmund.
Atletico, who began the game three points behind Real in third spot and seeking a first win in 22 meetings with their city