The England striker, 33, joins West Ham as a free agent after rejecting a new contract offer from Newcastle United.
Wilson has signed a 12-month deal with the Hammers.
He was limited to just 18 Premier League appearances last term and was stuck behind Alexander Isak in the pecking order.
"I'm excited to be joining a massive football club like West Ham," said Wilson.
"A club that shares a similar passion to mine - hard work, dedication, and also I strive for success so I'm glad to be a part of it.
"There's such talent within the squad. And obviously the gaffer (Graham Potter) has come in now, he's making everybody a team - all working in the same direction to achieve the goal which is to be finishing as high as possible in the league."
