Cristiano Ronaldo was sent off for kicking out at an opponent but Real Madrid still beat Cordoba 2-1 away on Saturday 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.
Neymar was upended in the box by Sergio Pelegrin and Messi scored the penalty after 55 minutes. Elche midfielder Faycal Fajr was dismissed for a second yellow card two minutes later.
Messi was the provider twice for Neymar who finished clinically after 69 and 72 minutes before the Argentine got his second two minutes from the end.
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.
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.
Nabil Ghilas gave Cordoba the lead from the penalty spot with two minutes played following a handball by Sergio Ramos.
Real lacked rhythm and intensity in their link-up play but Karim Benzema scrambled home an equaliser midway through the first half after Bale flicked on a corner.
Cordoba had looked more likely to win the game and Florin Andone hit the crossbar after 67 minutes with a lob over goalkeeper Iker Casillas.
Later champions Atletico Madrid, in third and seven points off the pace, host Rayo Vallecano.