Karim Benzema fired between the legs of Sergio Asenjo and added a controversial second from a retaken penalty.
In bizarre fashion, Sergio Ramos had rolled the first attempt for Benzema to smash in but the effort was disallowed.
Vicente Iborra pulled one back but it mattered little to Real as the club wrapped up their 34th Spanish title.
Zinedine Zidane’s side have won all 10 of their matches since Spanish football restarted in June.
They head into the final day of the season with an unassailable seven-point lead over second-placed Barcelona.
Recharged Real end Barca dominance
Behind closed doors in a 6,000-seat stadium at the club’s training complex is perhaps not the stage for the grand crowning Real would have imagined for their first title since 2017.
But that did not stop Zidane’s squad pulling on shirts with “Campeones 34” printed on the back before lifting the trophy in celebration as ticker tape fell over the pitch.
“Today is one of the best days for me as a professional,” said Zidane. “After everything that happened, the three-month break, it is fantastic what has been achieved.
“It is strange for everyone. We cannot control the situation. We would have loved to be with the supporters, and hopefully that can happen down the line.”
La Liga titles have been in shorter supply than Champions League triumphs for Real this decade, with this only their third in the past nine seasons.
They won three successive European Cups in Zidane’s first tenure but had recorded successive third-place finishes since their previous domestic title, as Barcelona were crowned champions.
Zidane was in charge the last time they won the league and made it his aim to reclaim the title after returning midway through the last campaign – less than a year after his departure.
It looked as if the Frenchman’s side would fail to deliver on that objective when football in Spain was suspended because of the coronavirus pandemic in March, with Barcelona top of the table.
But Real have been in scintillating form since the restart and did not look like losing after Benzema’s opener on Thursday. His second from the spot put the game beyond Villarreal’s reach, despite a nervy final few minutes.
In the end, Barcelona’s defeat by Osasuna made the victory a little more comfortable but no less significant for Zidane, who was hoisted into the air by his players.
Scheming Ramos let off the hook
Real’s title-winning moment looked like set to be relatively straightforward. Step forward Sergio Ramos.
The defender was brought down as he entered the Villarreal box after a marauding run and, after a VAR check, put the ball down on the spot.
The forward fired past an unsuspecting Asenjo, only to for referee Alejandro Hernandez to blow his whistle for infringement – presumably by Benzema.
Real were given the option to take the penalty again and this time Benzema converted to make it 2-0.
Iborra then headed in seven minutes from time before substitute Marco Asensio thought he had re-established Real’s lead, but Benzema had handled in the build-up.
“It has been a strange season but our objective was very clear once the league restarted,” said Ramos afterwards.
“We wanted to win every game. This is the reward for all our hard work. 34 leagues, my fifth title.
“Zidane has been key, he is the captain of the ship and led us from the start of the season – we have always felt protected with Zizou. He is a unique coach.”