The 26-year-old, who joined the Hammers from Pachuca for £12m in 2014, had held talks with Swansea on Wednesday.
But he will now link up with the Toffees on his return from international duty with Ecuador.
Valencia had made six appearances this season but was facing competition from new Hammers signing Simone Zaza.
Meanwhile, Everton have signed Sheffield United forward Dominic Calvert-Lewin for an undisclosed fee on a four-year deal.
The 19-year-old made 11 league appearances for the Blades, failing to score.
Subscribe to the BBC Sport newsletter to get our pick of news, features and video sent to your inbox.

Downing, who had only been offered a one-year deal by the Saddlers, made 183 appearances for the club following his release by West Brom in August 2012.
The 24-year-old centre-back has also previously been out on loan at Hereford United, Shrewsbury Town and Barnet.
"I've always liked Paul as a player," said Dons boss Karl Robinson.
The transfer will officially be completed once Downing's existing Walsall deal expires on Thursday.
Downing was one of three out-of-contract mainstays from last season's beaten League One play-off semi-finalists to leave the club, having turned down their respective offers.
Jason Demetriou signed last week for another League One side Southend, while Romaine Sawyers, remains linked with former Saddlers boss Dean Smith at Championship side Brentford.
Find all the latest football transfers on our dedicated page.

In the programme, a man who said he too was a former IRA and Sinn Féin member turned British agent, alleged that the Sinn Féin leader approved the killing of Denis Donaldson in 2006.
The former spy cannot be identified because of fears about his safety.
Mr Donaldson was shot dead months after admitting that he had been an MI5 agent for more than 20 years.
Three years later, the Real IRA said it was responsible.
On Wednesday, Mr Adams said he "specifically and categorically" denied the allegations, describing them as "part of the British security agencies ongoing attempts to smear republicans and cover up their own actions".
He said he would consider taking legal action against the BBC.
"I've taken a number of cases against various periodicals, I got a number of corrections and apologies from a number of outlets," said Mr Adams.
"If my legal advisers give me the type of guidance that I require, I will sue them. I'm not reluctant to sue.
"That the BBC would broadcast unsubstantiated allegations from an anonymous person, a self-confessed agent, about me, I think it's very, very low journalism indeed."
Mr Adams said there was a need for all agencies to "fully co-operate with the ombudsman's investigation into the role of the police in the events that led to the killing of Denis Donaldson and for the Gardaí to expedite their investigation to bring those responsible to justice."
The Sinn Féin leader said he would "continue to support the family of Mr Donaldson to achieve truth and justice".
Mr Donaldson had worked for Sinn Féin as a senior administrator at Stormont. He was killed at a remote Donegal cottage in 2006.
What Spotlight was told
Agent: I know from my experience in the IRA that murders have to be approved by the leadership. They have to be given approval by the leadership of the IRA and the military leadership of the IRA.
Presenter: Who are you specifically referring to?
Agent: Gerry Adams, he gives the final say.
The informer told Spotlight that murders had to be approved by the political and military leadership of the IRA.
Days after Mr Donaldson's killing, the IRA said it was not involved in Mr Donaldson's death.
But security sources have told Spotlight that intelligence received following the killing contradicted the IRA's denial.
You can watch BBC Spotlight: Spy in the IRA now on BBC iPlayer.
Everton have signed West Ham striker Enner Valencia on a season-long loan, with the option of a permanent £14.5m move next summer.
[NEXT_CONCEPT]
MK Dons have signed defender Paul Downing on a two-year deal after he rejected a new contract offer from League One rivals Walsall.
[NEXT_CONCEPT]
Gerry Adams has denied claims in a BBC Spotlight programme that he sanctioned the murder of an IRA informer.