La Liga Wrap: Madrid move clear as Barca lose
Real were never in any problems at the Santiago Bernabeu once they opened the scoring through Asier Illarramendi, the midfielder netting his first league goal for the club via a deflection.
Gareth Bale added the second with a long-range strike that crashed off the crossbar on its way in, and Isco completed the win with a low shot past Manu Herrera with nine minutes remaining
Four hours later their lead at the top was confirmed as Barcelona were beaten 3-1 in San Sebastian.
Gorka Elustondo's header deflected off Alex Song to give Sociedad the lead at Anoeta, but Barca soon responded with an equaliser through Lionel Messi - his sixth goal in five matches against Sociedad.
However, that was not enough and Barcelona fell to a shock defeat as the hosts scored twice in five second-half minutes to seal the three points and extend their unbeaten home record against the Catalan giants to five games.
Antoine Griezmann, who was impressive throughout, put Jagoba Arrasate's side back in front with a sliding finish following a square pass from Carlos Vela and the Frenchman turned provider for David Zurutuza to complete the victory.
The defeat is a huge blow to Barcelona's title hopes, while Sociedad move above Villarreal and into fifth.
Celta extended their unbeaten run in the league to five games as they came from a goal behind to rescue a point in a 1-1 draw against Getafe in Vigo.
The visitors opened the scoring in the 20th minute through Lafita, but eight minutes into the second half they were reduced to 10 men as Lisandro Lopez was given a second yellow card.
Celta used their man advantage almost immediately as Rafinha levelled in the 59th minute, and Luis Enrique's side nearly won it in stoppage time but Nolito's strike hit the woodwork.
Meanwhile, at the bottom of the table, an inspired performance from Wily Caballero helped earn Malaga a 0-0 draw against Almeria.
The goalkeeper made a string of saves to deny the hosts as both sides ended winless runs with a much-needed point.
Both sides creep away from the bottom three with the point, with Malaga now three points ahead of Valladolid.