Cristiano Ronaldo was sent off for kicking out at an opponent but Real Madrid still beat Cordoba 2-1 away while Barcelona kept on their heels with a 6-0 demolition at Elche.
Lionel Messi and Neymar hit second-half braces for Barca after Gerard Pique celebrated his 200th La Liga appearance with a volley that clipped off Domingo Cisma and into the roof of the net 10 minutes before the break.
Messi has now equalled the record of doubles scored in La Liga after notching up his 77th to match the total set by Telmo Zarra, of Athletic Bilbao, in the 1940s and 1950s. It is the latest in a long line of records for the striker, who became the highest scorer in La Liga history earlier this season.
There was still time for Pedro to get the sixth from close range after being found by Neymar.
Earlier, Ronaldo kicked out at defender Edimar with seven minutes to go as Real struggled to create chances but they were gifted the win when a Gareth Bale free kick was handled by Fede Cartabia in the area.
Cartabia was also sent off for a second bookable offence and, with Ronaldo off the pitch, Bale fired home the winning penalty with two minutes left.
Real have been unable to maintain the form that saw them string together 22 consecutive victories in all competitions before the mid-season break but they remain in top with 48 points, one more than Barca and also with a game in hand.