League leaders Barca edged out Getafe 1-0 at the Nou Camp, with Pedri grabbing the decisive goal in the 35th minute. It was far from a regulation win for the hosts, with Marc-Andre ter Stegen called on to make some important saves, but it was enough to keep Xavi's side unbeaten at home.
Second-placed Real looked to be on course for a similarly narrow success at Athletic Bilbao, with Karim Benzema on target in the 24th minute, but Toni Kroos popped up in the closing seconds to add the sheen to a 2-0 scoreline.
Villarreal scored the second of two injury-time penalties to see off 10-man Girona 1-0. Gerard Moreno missed the first spot-kick in an extended period of added play, but Dani Parejo hit the target when he took an even later effort.
In Italy, Juventus drew a six-goal thriller against Atalanta in their first match since being hit with a 15-point deduction for transfer financial irregularities.
Juve have been dumped into Serie A's mid-table as a result of the sanction and began the long process of reclaiming lost ground with a point and a 3-3 scoreline. Former Everton forward Ademola Lookman scored twice for Atalanta, while Angel Di Maria, Arkadiusz Milik and Danilo were on target for the Bianconeri.
Roma kept in touch with the top three as they notched a 2-0 away win over Spezia. Stephan El Shaarawy scored on the stroke of half-time and England striker Tammy Abraham made it safe early in the second half.
Sampdoria remain in deep trouble at the wrong end of the table following a 1-0 defeat by Udinese, and now have just nine points from 19 games.