Carlos Bacca put the LaLiga side in front with a stunning strike after 45 seconds, although they were made to regret missed chances as Scott Arfield found his first Rangers goal midway through the second half.
Parity did not last two minutes as Villarreal substitute Gerard Moreno got in on the act, but it was Steven Gerrard celebrating 14 minutes from time when Kyle Lafferty crowned a brilliant team move.
Bacca got a touch fortunate when his attempted flick from Pablo Fornals' pass bounced back to him off Joe Worrall but the Colombia striker's sumptuous finish from 25 yards with the outside of his foot was out of the top drawer.
Rangers goalkeeper Allan McGregor was caught off his line for the opener but kept out a rasping Santi Cazorla drive to ensure Villarreal's advantage remained slim at the break.
McGregor dashed from his area to thwart Karl Toko Ekambi in the 49th minute and saw Bacca slot wide of an unguarded goal.
Ekambi then blazed over at the far post after Cazorla and Fornals picked Rangers apart and McGregor saved brilliantly from Ramiro Funes Mori's fierce low strike.
Such resilience was rewarded in the 67th minutes as visiting captain James Tavernier launched a slaloming run into the Villarreal box. Victor Ruiz brought him down but Daniel Candeias was alert to the loose ball and cut in a low cross for Arfield to score.
The response was instant as Moreno darted inside Borna Barisic to thrash in at McGregor's near post.
Barisic atoned for his role in that goal by racing on to Glenn Middleton's throughball – the highlight of an excellent cameo from the teenager - to leave Lafferty with a simple finish from his first-time cross.
Arfield, Moreno and Bacca all spurned fine chances to snatch the win in a frantic finale.