Los Blancos, back in action for the first time since winning the Club World Cup, appeared to be headed for three points as Karim Benzema and Raphael Varane cancelled out Cazorla's crisp early opener by the 20th minute.
But with just eight minutes remaining, Cazorla ghosted in to head Pablo Fornals' teasing cross past Thibaut Courtois to secure a share of the spoils.
Madrid, who lost the ineffective Gareth Bale to injury at half-time, are consequently fourth and seven points behind leaders Barcelona after 17 matches, while Villarreal are out of the bottom three but remain level with 18th-placed Athletic Bilbao.
Madrid had won their last three league matches without conceding but just four minutes had elapsed when Samuel Chukwueze picked out Cazorla, who curled the ball into the bottom-right corner for his first LaLiga goal since returning to the club in August.
The lead lasted all of three minutes as Benzema headed a right-sided cross from Lucas Vazquez past Sergio Asenjo from eight yards and the turnaround was complete when Varane leapt highest to guide Toni Kroos' deep free-kick back across goal.
Luka Modric then converted from close range after Kroos had a shot kept out by Asenjo, only for the offside flag to cut short his celebrations.
Madrid made a slow start to the second half but could have extended their lead on the hour, with Vazquez profiting from a favourable deflection but shooting right at Asenjo.
That would prove a costly miss as Fornals delivered the ball into the back post for Cazorla to head past Courtois.
An end-to-end conclusion to the match ensued, with Bale's half-time replacement Isco forcing Asenjo into a late save with his bullet strike, but Villarreal earned a crucial point on their quest to dodge the drop and inflicted a big blow on their opponents' outside title hopes.
What does it mean? Madrid miss big chance to close gap
A trip to a side sitting third-bottom of the division at the start of the game should have meant three simple points for Madrid, though this latest slip-up makes it just three wins from nine away LaLiga matches. After missing out on a fourth league win on the spin overall, Solari's charges remain fourth in the division and have surely relinquished any slim hopes they had of challenging Barcelona for the title.
Cazorla shows signs of his best
Not only did Cazorla score both of his side's goals, the former Arsenal ace also chipped in with five key passes during the 90 minutes. The opening goal early on was special, working the angle well to send the ball out of Courtois' reach, but he also showed great awareness in the final 10 minutes to get away from his man and guide Fornals' cross from the left into the back of the net.
Bale ineffective before injury scare
Plenty of eyes were on Bale, who top scored for Madrid at the Club World Cup in the United Arab Emirates last month, but he endured a frustrating opening 45 minutes here and did not emerge for the second half - the 15th time he has been replaced in LaLiga this term, more than any other player.
The Wales forward failed to capitalise on some poor positioning from opposition right-back Miguel Layun and left the field with the lowest pass completion rate of any outfield Madrid player. After succumbing to another suspected calf problem, which twice required treatment before he was replaced by out-of-favour Isco, Bale's playing time may be curtailed during a crucial period.
Key Opta Facts:
- Villarreal's Santi Cazorla has scored his first brace in La Liga since September 2011 for Malaga against Granada, 2670 days ago.
- Real Madrid are the LaLiga side with the most headed goals scored this season in all competitions (11) and their striker Karim Benzema is the player with the most headers (five).
- Benzema has scored 12 goals in 27 games this season in all competitions, as many as he did in the whole of last season (12 but in 47 games).
- Cazorla has scored his first headed goal in La Liga (41 goals in total).
- No other Real Madrid player has made more assists than Lucas Vazquez since the start of last year in all competitions (12, the same as Karim Benzema).