The champions remain 12 points behind leaders Barcelona, who face Girona on Monday, with Villarreal winger Samuel Chukwueze scoring twice in a sensational individual display.
Pau Torres’s own goal sent Madrid in front but Chukwueze levelled before the break.
Vinicius Junior netted a superb solo goal before Jose Luis Morales levelled and Chukwueze curled home a superb winner, which reduced Madrid’s hopes of retaining the title to virtually nothing.
Carlo Ancelotti made six changes from the 4-0 Clasico thrashing of Barcelona in the Copa del Rey midweek, with Chelsea’s visit on Wednesday in mind.
However, the Italian coach maintained his attacking trio of Karim Benzema, Rodrygo and Vinicius, looking to put the game to bed early.
Real Madrid took the lead in the 16th minute after an electric break, with Marco Asensio driving the team forward and Vinicius’ low cross ricocheting off Torres into his own net.
Villarreal’s veteran goalkeeper Pepe Reina made two fine saves to deny Benzema and Rodrygo as Madrid tried to stretch their advantage, while Madrid stopper Thibaut Courtois twice denied Alex Baena from distance.
The visitors levelled late in the first half when Chukwueze’s magical footwork left defender Nacho Fernandez for dead, and the Nigerian finished clinically past Courtois.
Madrid came out flying in the second half and Vinicius scored a brilliant goal of his own, nutmegging defender Aissa Mandi to leave a crowd of perusers behind him, before slipping the ball home.
The Brazilian winger, on 21 goals across all competitions, should have matched his tally of 22 last season but fired into the side netting after being teed up by Benzema.
The French forward, who scored hat-tricks in both his previous two games, was withdrawn before the hour mark to rest him for the Chelsea clash.
Villarreal pulled themselves level in the 70th minute when Chukwueze’s cross caused danger and substitute Morales finished well.
The goal was initially ruled out for offside against Chukwueze, but VAR informed that the Nigerian was onside.
With 10 minutes remaining, Chukwueze scored a brilliant second, curling into the top corner from outside the area, to send Villarreal in front.
It was his fifth goal in his last seven La Liga matches, with Chukwueze in the best form of his career.
As Madrid scrambled for a leveller they were awarded a penalty when the ball appeared to strike Mandi’s arm as he slid along the floor.
However, after consulting VAR replays, the referee cancelled his penalty award, and Madrid were beaten.
AFP