Real manager Zinedine Zidane had downplayed criticism this week about the state of the club, which entered the fixture 16 points behind rivals Barcelona in the La Liga table, and emphasized the importance of remaining optimistic during the second half of the term.
Pablo Fornals netted Villarreal's victor in the 87th minute, prompting loud boos by the home crowd which three days ago saw their team draw with second-division club Numancia 2-2 in the Copa del Rey.
Real Madrid were the better team in the opening forty-five minutes with the best chances seeing a header from Gareth Bale being ruled out for an offside infringement and a free-kick from Cristiano Ronaldo hitting the cross-bar.
As the home side poured forward in search of a victor, they were caught on the break; Fornals chipping in the rebound after Keylor Navas saved from Eres Unal.
BC-SOC-Spanish Roundup, 3rd Ld-Writethru, 594 More jeers for Real Madrid after home loss to VillarrealAP Photo PW101, PW107, PW106, PW104, PW103, PW105, PW102Eds: Updates with Atletico Madrid win.
"This wasn't about a lack of focus, the ball just didn't want to go in", Carvajal told reporters.
Anti-racism protests hit S. African H&M stores
Video footage showed activists trashing displays, kicking over and pulling down clothes rails as well as pushing over mannequins. This is not the first time the retail giant has come under fire in South Africa.
"There is no explanation for this", Zidane said.
Real Madrid, the defending La Liga champions, are now fourth, 16 points behind leaders Barcelona.
Real's slim chances of getting back into the title race after their 3-0 defeat by Barcelona before Christmas had faded further with last week's 2-2 draw away to Celta Vigo and, coupled with the persistent rain, there was little enthusiasm for the game at the Bernabeu, which was three-quarters full.
"This is very hard for us, it seems like everything is bad at the moment and we are in the middle of a tornado, but I think deep inside we are strong and we believe in each other, but anyone who doesn't should get off the boat", Carvajal added. Villarreal are a team that likes possession, but we have played a good match in general. "We have to start winning, and winning convincingly, then things will change".
"We knew we could make history", Villarreal coach Javier Calleja said.
Kenyan forward Michael Olunga scored a hat trick to lead promoted Girona to a 6-0 trouncing of last-place Las Palmas.