Real Sociedad welcomed Villarreal to the Anoeta for the second leg of their last-16 Copa del Rey clash on Wednesday.
The visitors entered the match as the slight favourites to advance following a 1-0 win in the first leg at El Madrigal last week.
Villarreal led 1-0 after 27 minutes when Gerard Moreno found the back of the net, but Carlos Vela levelled the scores on the night moments before the half-time whistle.
Giovani dos Santos made it 2-1 Villarreal after 73 minutes, but Esteban Granero levelled the scores two minutes later.
Sociedad entered the final 10 minutes needing to score two more goals and they had a helping hand when Mateo Musacchio was sent from the field for a second bookable offence.
However, Villarreal survived the latter stages to secure their spot in the next round, where they will meet Getafe.
Read how it all unfolded in Sports Mole's minute-by-minute live commentary of the action below.
SOCIEDAD: Rulli; Yuri, Mikel, Inigo, A.Elustondo; Canales, Granero, Prieto, Pardo; Vela, Agirretxe
VILLARREAL: Asenjo; Rukavina, Musacchio, Dorado, J.Costa; Pina, Trigueros, Moi, Nahuel; Giovani, Gerard
© Getty Images