Jonathan Pereira sped onto a Cani through ball to net the winner in the 56th minute at a packed and festive Madrigal stadium to lift Villarreal to 77 points from 42 matches, five behind Elche, who won 3-1 at home to Guadalajara.
"This is incredible," Villarreal midfielder Bruno Soriano said in an interview with Spanish TV broadcaster Canal Plus.
"It was a very tough year but now we can celebrate and just listen to that," he added, gesturing to the wild celebrations erupting around him.
Almeria, Girona, Las Palmas and Ponferradina, who finished in third through sixth respectively, will play off for the third and final promotion berth.
Known as "yellow submarine" due to their distinctive canary-yellow strip, Villarreal were relegated in the 2011-12 season after 12 successful years in the first division when they defied their modest budget to compete with La Liga heavyweights like Real Madrid and Barcelona.
Under Chilean coach Manuel Pellegrini they finished third in the 2004-05 campaign and qualified for the Champions League for the first time, falling in the semi-finals the following
- Sports & Recreation
- Bruno Soriano