The 30-year-old spent the 2016-17 campaign on loan at the Estadio de la Ceramica and has signed a four-year deal after Villarreal exercised their purchase option.
Fernandez started the season as back-up to Sergio Asenjo but became the first-choice goalkeeper when the latter suffered a serious knee injury.
He made 20 appearances in all competitions for Villarreal last term.
Fernandez started his professional career with Mallorca B and represented Osasuna and Huesca before joining Porto in 2014.
He failed to secure regular first-team football at the Portuguese giants, though, and has now returned to his native country permanently.