The 26-year-old, who has played six times for his country, spent the second half of last season at Tottenham after they hijacked a deal for him to move to Goodison Park in January.
He scored only once in the Premier League for Spurs, netting during the 3-2 home defeat to Bournemouth in April.
He was Villarreal’s top scorer during their run to the Champions League semi-final in 2022 but subsequently fell out of favour and was made available for loan.
Bournemouth signed him to try to salvage their top-flight status in January 2020 but he failed to register a goal as Eddie Howe’s side dropped into the Championship.
“It’s amazing to join Everton and I’m really happy to be here,” he told Everton’s website. “It’s been a long time coming to join such a massive club as Everton and it makes me proud.
“I had interest from other clubs but there was a pull towards Everton because of the fans, the manager and the history of the club and it’s second time lucky for me.
“I know I did not move to the club in January, that was because there was some uncertainty over the manager situation at that time, but I think it makes it even more beautiful for me to join now.
“I am very grateful to be at the club and I can’t wait to play in front of the fans as well.”
He becomes manager Sean Dyche’s second signing of the summer after Ashley Young joined following his release from Aston Villa.