Villarreal scored three late goals to move into the Champions League quarter-finals as Juventus went out in the last 16 for a third successive year.
The Spanish side did not have a shot on target before substitute Gerard Moreno converted a 78th-minute penalty after Daniele Rugani fouled Francis Coquelin.
Defender Pau Torres added a second when he finished from six yards as Juventus failed to deal with a corner.
Arnaud Danjuma made it 3-0 with another penalty after Matthijs De Ligt handled.
“We had a gameplan and knew there’d be tough moments,” said Villarreal boss Unai Emery.
“Whoever we get in the draw will be a top side, just like the one we faced.”
The draw for the quarter-finals takes place on Friday at 11:00 GMT and Villarreal will be in the last eight of the competition for the first time since 2008-09 and only the third time in their history.
Following a 1-1 draw in Spain last week, two-time European champions Juventus were clear favourites to advance and they dominated the first half at the Allianz Stadium.
However, Juventus’ Dusan Vlahovic, a goalscorer in the first leg, hit the crossbar and was also twice denied by Villarreal goalkeeper Gero Rulli, who also saved an effort from ex-Chelsea striker Alvaro Morata.
Villarreal, managed by former Arsenal boss Emery, had to defend deep and in numbers for the majority of the second half.
However, in a rare attack, substitue Coquelin was fouled by Rugani with referee Szymon Marciniak awarding the penalty after watching it on a pitchside monitor.
Moreno, only on the pitch for four minutes, kept his cool to put his side ahead as home goalkeeper Wojciech Szczesny got both hands to the shot but could not keep it out.
Juventus had been eliminated at this phase of the competition in both the past two years, going out to Lyon in 2020 and Porto in 2021, and fell apart in the last 10 minutes.
Terrible defending from a corner allowed Torres to double Villarreal’s advantage before former Bournemouth striker Danjuma converted another spot-kick in injury time.
Juventus coach Massimiliano Allegri said: “I think the team played well for over 75 minutes.
“In the second half, Villarreal decided to just defend and block but they had one chance and they took it. Football is like that: one episode can change everything.
“Villarreal defended with 11 men, clearly trying to bring the game to extra time. Then that goal changed everything.”
Villarreal, seventh in La Liga, had qualified for the Champions League courtesy of winning last season’s Europa League final – beating Manchester United 11-10 in an epic penalty shootout as United goalkeeper David de Gea missed the decisive penalty.