An injury-time strike from substitute Imanol Agirretxe condemned 10-man Barcelona to a 3-2 defeat at Real Sociedad on Saturday, their first of a record-breaking Primera Division season.
Lionel Messi scored in a 10th consecutive game for a landmark second time, putting Barca ahead after six minutes with Pedro Rodriguez doubling lead.
But Chory Castro pulled a goal back before the break and then got his second after 63 minutes.
With Gerard Pique off the field after receiving a red card, Agirretxe got the winner in the 91st minute.
There appears to be no record out of reach for Messi who scored in 10 straight matches in the 2011-12 season, notching up 18 goals in the process.
It equalled the mark set by Ronaldo, who scored 12 in 10 games during the 1996-97 season, and Mariano Martin who put away 18 in 10 matches between 1942 and 1943.
Messi has now hit 15 goals in 10 games and 29 overall in the league this season, but it counted for little on the night.
Barca went into the game having set a new record for a Primera Division start with 18 wins - and just one draw against Real Madrid - for 55 points from a possible 57.
Despite the loss, they are still 11 points ahead of Atletico Madrid, who play Levante on Sunday, and Real Madrid in third, who face Valencia, a huge 18 points off the pace.
Barca once again began with Andres Iniesta in attack alongside Messi and Pedro Rodriguez with Alexis Sanchez struggling for form and David Villa injured.
Real Sociedad played the more defensive Markel Bergara in midfield rather than Ruben Pardo but even so they were under threat right from the start with a ball over their backline from Iniesta saw Messi scamper clear on goal.
On this occasion, he slotted the ball the wrong side of the post but he was not so forgiving minutes later as he fired Barca ahead.
Iniesta was once again involved as he slipped the ball to Messi on the edge of the area and he picked his spot in the corner past the desperate dive of keeper Claudio Bravo.
A weakened Barca had drawn 2-2 with Malaga at Camp Nou in the first leg of the Spanish Cup quarter-final after they dropped their level after the break but they came out all guns blazing in San Sebastian.
Still Real have a dangerous forward line of their own and they went close to equalising after 10 minutes when Carlos Vela knocked a free-kick to Xabi Prieto, who had been left unmarked in the box, but he hit the side netting.
Real were refusing to sit back and defend and wait for their chances on the counter as so many sides do against Barca but it meant they left themselves open at the back and Pedro hit the post with a 20 yard strike on his weaker right foot.
The Canary Islander did extend Barca's lead midway through the half as he slid in to knock home a Dani Alves cross from close range.
Barca were again denied by the post after Messi had lobbed the ball over the keeper and then Real got back into the game through Castro who fired in a clinical drive from the left of the area after being set up by Vela.
After the break Real managed to ruffle Barca with Pique receiving a second yellow card and then Castro got his second of the night.
Real were pressing forward and an Asier Illarramendi deep cross found Castro whose shot was deflected in off Javier Mascherano.
There was no late rally this time as has so often happened this season from Barca and instead they conceded at the death as Agirretxe scored from close range.