First-half goals from Gareth Bale and Cristiano Ronaldo saw Madrid lead at the interval, but Villarreal scored twice in the second period through Roger Martinez and Samu Castillejo as the points were shared on the night.
The draw means that Atletico Madrid are confirmed as second-placed finishers in Spain's top flight this season, with Real Madrid in third and Villarreal ending the campaign in fifth.
As for Real Madrid, head coach Zinedine Zidane handed a first-team debut to his son Luca Zidane between the sticks, but it was otherwise arguably the Frenchman's strongest team, with Bale keeping his spot following a fine run of form.
Villarreal had the first opportunity of the match inside three minutes, but Unal could only send the ball wide of Luca Zidane's post from an advanced position.
Ronaldo's first involvement saw the Portuguese test Fernandez with a rasping effort in the eighth minute, but Madrid took the lead three minutes later through Bale.
Indeed, a quick free kick released the Welshman in a dangerous position, and he settled inside the Villarreal box before finishing into the bottom corner of the net to send another message to Zinedine Zidane ahead of the Champions League final in Kiev next weekend.
Ronaldo fired over the Villarreal goal in the period that followed as the visitors chased a second, although the home side remained a threat in the final third with the movement of Unal causing problems.
Pablo Fornals struck just wide of the Real Madrid goal in the 30th minute, but the visitors doubled their advantage two minutes later when Ronaldo headed a Marcelo cross into the far corner of the net.
Luka Modric and Isco both came close to adding to the scoring in the period that followed, while Fernandez also had to make another flying save to keep out a strike from Toni Kroos as the European champions continued to dominate.
Luka Zidane made a wonderful save to keep out a dipping Sansone free kick early in the second period, before Unal missed the Real Madrid goal from a similar distance just before the hour mark.
Ronaldo and Modric both exited the field in the 62nd minute as Zinedine Zidane's attention switched to next weekend's clash with Liverpool, and Villarreal continued to have their moments in the second period.
Super work from Sansone set up a brilliant chance for Unal in the 67th minute, but Ramos managed to clear off the line.
Villarreal did have one back in the 71st minute, however, when substitute Martinez picked out the top corner with a stunning effort from inside the Real Madrid box.
The home side then levelled the scores in the 85th minute when Castillejo broke the offside trap before beating Luca Zidane to the ball and finishing into the back of the net.
Real Madrid came close to snatching all three points at the death when Karim Benzema curled one towards the far corner, but Fernandez was on hand to make a flying save, before Lucas Vazquez fired wide moments later as the points were shared on the final weekend of the campaign.
VILLAREAL (4-5-1): Andres; Mario, Bonera, Alvaro, Marin; Soriano, Rodrigo, Fornals (Samu 77'), Fuego (El Dawsari 57'), Sansone; Unal (Martinez 67')
REAL MADRID (4-3-3): Luca Zidane; Carvajal, Ramos, Varane, Marcelo; Casemiro, Modric (Lucas 62'), Kroos; Ronaldo (Benzema 62'), Bale, Isco (Kovacic 73')