West Ham have announced the signing of Spanish attacking midfielder Pablo Fornals from Villarreal.

Fornals, 23, has agreed a five-year contract with the Hammers, which includes the option of a 12-month extension.

West Ham said Fornals had become "the second most-expensive signing in the club's history behind Felipe Anderson", the Brazilian having arrived last summer in a reported £34million deal.

Fornals is set to feature for Spain at the European Under-21 Championship in Italy.

"I'm very happy to be part of West Ham," Fornals said to the club website. "I feel very good, very happy and very grateful for the opportunity that has been provided to me.

"I want the club to continue giving opportunities to young and ambitious people, people who want to do well for the long term."

Fornals, who has two senior Spain caps, is reported to have cost around £24m and worked with West Ham's director of football Mario Husillos during their time at Malaga.

"I know about the loyal fans and the stadium, which is a beautiful stadium," Fornals added.

"The fans fill the stadium every weekend and that is something admirable, especially with the passion with which football is lived there. I think it is important to play with the support of your fans at home."

Fornals is also looking forward to linking up with Irons boss Manuel Pellegrini, who guided the team to 10th place in the Premier League last season.

He said: "Of course, Manuel was a big influence because in the end he is one of the best coaches in the world and who doesn't want to work with people like that?"

Fornals made 63 appearances for Villarreal across two seasons, scoring seven goals.

Husillos is confident West Ham are getting a player full of potential, Fornals having made his LaLiga debut against Real Madrid when aged 19.

"He is a player we have monitored closely for some time, having seen him make excellent progress as a young midfielder in one of the best leagues in the world," the West Ham director of football said.

"I personally have followed his career since he was a youth player with me at Malaga, and I know we have signed an incredible professional and an incredible character.

"He joins us a young player still with many years ahead of him, yet with strong experience and already proven at the very highest level.

"We look forward to seeing the impact he will have in a West Ham shirt, and believe that he has all of the qualities required to become a big success in the Premier League."

Fornals becomes West Ham's third summer signing, following the arrival of experienced goalkeepers Roberto and David Martin.