Real Madrid lost to Levante 1-0 and lost its lead of the Spanish league to Barcelona after a four-goal performance by Lionel Messi on Saturday.
Barcelona routed Eibar 5-0 at the Camp Nou and will enter next weekend's clásico against Madrid with a two-point lead at the top of the standings.
José Luis Morales scored a 79th-minute winner for mid-table Levante, which had won only one of its last 14 league games against Madrid.
Before the clásico, Barcelona and Madrid have round-of-16 matches in the Champions League — Barcelona visits Napoli on Tuesday and Real Madrid hosts Manchester City on Wednesday.
Madrid dominated and created more scoring chances against Levante. Eden Hazard and Karim Benzema went close in one-on-one situations in the second half, but Benzema missed wide and Hazard's shot was saved. Benzema, Lucas Vázquez and Luka Modric already missed good chances in the first half at Ciudad de Valencia Stadium.
Morales scored the winner with a powerful left-footed shot from inside the area, hitting the top corner of Madrid goalkeeper Thibaut Courtois.
Hazard was limping when he was substituted by Vinícius Júnior in the second half. Doctors immediately put ice on his right ankle but the severity of the injury wasn't clear.
Levante moved to 10th place with the win, its second in three matches.