Barcelona lost at home in La Liga for the first time in more than two years as Real Betis pulled off a stunning 4-3 victory, despite Lionel Messi scoring twice on his return from injury.
Barca last endured a league defeat at the Camp Nou against Alaves in September 2016 but, following 42 games unbeaten, their run was ended by a brilliant, counter-attacking display from Betis on Sunday.
Three hours later, Real Madrid were putting the finishing touches to a 4-2 win away at Celta Vigo, a result expected to earn Santiago Solari an extension to his tenure as coach.
Real have now posted four consecutive victories since Solari was put in temporary charge while the gap behind Barca has been reduced to four points.
"He has done excellently," Madrid club director Emilio Butragueno said afterwards.
"We are very happy with how things have gone."
On his future, Solari said: "We'll see. I don't usually plan too far ahead but in principle, it's my day off tomorrow."
Barca's shock defeat came despite a return for Messi, whose two goals, one from the penalty spot and another deep into injury-time, proved little more than consolations.
"We don't leave with the feeling Betis were the better team," coach Ernesto Valverde said.
"I don't want to take any credit away from our opponent but we could have countered them better."
It was the first time ever that Messi scored twice and Barcelona lost, but they stay top of the table, even if three clubs now lurk just one point behind.
Atletico Madrid, whom they face at the Wanda Metropolitano after the international break, Sevilla and Alaves lead the chasing pack.
Alaves beat Huesca 2-1 earlier on Sunday, while Sevilla won by the same scoreline at home to Espanyol, Wissam Ben Yedder prodding in an 89th-minute winner.
"Top of the table is fine, I won't deny it," Valverde said.
"It should also help us to realise it is never easy to win."
Betis' reward for beating Barca is to climb to 12th. Quique Setien's side may have pulled back on the sumptuous, attacking football that earned them a sixth-place finish last term but, in full flow, they remain one of Spain's most difficult opponents to stop.
"We have been a brave team in every way," former Spain international Joaquin said.
"Winning at the Camp Nou requires concentration and doing everything very well. We played a great game."
- Faster, sharper and hungrier -
Betis seemed faster, sharper and hungrier while Barcelona's midfield was repeatedly carved open on the break.
It took five passes for the opener, the last a first-time drive from William Carvalho to free Junior Firpo down the left. He weaved inside Sergi Roberto and struck hard into the net.
Barca had chances but Betis were soon pouring forward again, with Junior's cross evading everyone except Giovani Lo Celso on the opposite flank. His cute cut-back picked out Joaquin, who stabbed in Betis' second.
Arturo Vidal replaced the jaded Arthur Melo at half-time and, in the 68th minute, Barca pulled one back, with Jordi Alba tugged down by Cristian Tello, and Messi converting the penalty for his eighth league goal of the season.
But the recovery stalled three minutes later as Marc-Andre ter Stegen let Lo Celso's shot slip through his fingers and drop into the far corner for 3-1.
Barca were not done yet. Two substitutes combined for a second, Munir El Haddadi laying on Vidal but no sooner had the comeback begun again, it was halted.
First, Ivan Rakitic was sent off, a second yellow card for a late challenge on Lo Celso, and then Sergio Canales tapped in Betis' fourth from Junior's cross. Messi added his second in injury-time but there was to be no more late drama.
Madrid's win was more straightforward as Karim Benzema opened the scoring, a sublime touch and turn making space for a crisp finish into the corner.
Benzema's shot then cannoned in off Gustavo Cabral before Hugo Mallo's sweet volley gave Celta hope.
Sergio Ramos, however, chipped in a late penalty, Cabral was sent off for a second yellow card and Dani Ceballos wrapped up the points with a superb long-range strike. Brais Mendez scored a second for Celta in injury-time.
The only blot for Solari was a spate of injuries which saw Casemiro, Sergio Reguilon and Nacho all forced off. Gareth Bale also took a knock to his left ankle in the first half but was able to continue.