Real Madrid slipped to just a second La Liga defeat of the season as they missed the chance to go back to the top of the table by losing at Villarreal.
Yeremy Pino put the hosts ahead but a dubious handball call against Juan Foyth allowed Karim Benzema to level.
Foyth then won a penalty of his own at the other end as David Alaba handled and Gerard Moreno slotted the winner.
Real remain second, level on points with leaders Barcelona, who visit Atletico Madrid on Sunday.
Villarreal climb to fifth after a deserved third successive win, having created the better chances throughout an entertaining affair Estadio de la Ceramica.
Alex Baena went close on several occasions during a first half the hosts bossed, while Francis Coquelin hit the post with a cheeky backheel from Moreno’s cross.
Benzema fashioned Real’s best first-half opening with a cushioned first-time pass on the volley for Vinicius Jr but the Brazil forward was denied by veteran keeper Pepe Reina.
Ferland Mendy’s misplaced pass led to Pino firing Villarreal ahead early in the second half but after a ball over the top grazed Foyth’s hand, the referee awarded a penalty upon viewing the pitchside monitor.
Benzema converted his 227th La Liga goal to move joint sixth in the all-time top scorers’ list, alongside Real legend Alfredo di Stefano.
But any injustice the hosts felt soon disappeared as Alaba slipped and handled Foyth’s low pass as he put his hand on the ground to steady himself, with Moreno coolly sending Thibaut Courtois the wrong way from the spot after vociferous Real appeals finally died down.