Not even two goals by Lionel Messi could save Barcelona from its first Spanish league home defeat in more than two years on Sunday when Real Betis won 4-3 at Camp Nou.
Real Madrid took advantage of Barcelona's unexpected slip by winning 4-2 at Celta Vigo to close the gap on the leaders.
Betis never trailed as it ended Barcelona's run of 42 unbeaten home games in the league that dated back to a 2-1 defeat to Alaves in September 2016.
Messi did all he could to keep Barcelona's streak going in his first game back since breaking a bone in his right forearm three weeks ago.
The Argentine forward scored a second-half penalty, set up substitute Arturo Vidal to reduce the deficit to 3-2, and added a final goal for the hosts late in stoppage time.
But Betis led 2-0 at halftime thanks to opening goals by Junior Firpo and Joaquin Sanchez. Giovani Lo Celso and substitute Sergio Canales then responded to Messi's spot kick and Vidal's goal, respectively, to keep Betis comfortably in front.
Barcelona was left with 10 men in the 82nd minute when Ivan Rakitic earned a second booking for a hard tackle on Lo Celso. A minute later Firpo led another attack for Betis from the left flank, passing for substitute Canales to slide and push in what proved to be the winner.
"They won the match in the first half," Barcelona coach Ernesto Valverde said. "We played a poor first half, and then each time we got closer they hit us right back."
Barcelona hadn't lost at home in any competition since Valverde's debut in the Spanish Super Cup at the start of the 2017-18 season, when it lost 3-1 to Real Madrid.
Barcelona remained one point ahead of Atletico Madrid, which it visits next round after an international break.
Sevilla and Alaves also moved level on points with Atletico after fighting back for victories.
Madrid remained in sixth place, but moved to within four points of leader Barcelona.
SOLARI IN CHARGE
Real beat Celta 4-2
Santiago Solari likely improved his chances that Madrid president Florentino Perez will decide to leave him in charge of the team after he coached Madrid to a fourth straight win since replacing Julen Lopetegui two weeks ago.
Solari had been promoted from the reserve team on an interim basis.
When asked about Solari's future, Madrid club spokesman Emilio Butragueno limited his comments to "what I can say is that we are very happy (with Solari)."
After Karin Benzema opened the scoring with a classy goal, Madrid got an own-goal by Gustavo Cabral, a penalty by Sergio Ramos and a late goal by substitute Dani Ceballos. Hugo Mallo and Brais Mendez scored for Celta, which never seriously threatened to equalize.
(With AP Inputs)