"West Ham United are delighted to announce the club-record signing of Austria attacker Marko Arnautovic," the Hammers said on their website.
"It feels special to me to be a West Ham player," said Arnautovic, capped 62 times for his country.
"Everyone knows that West Ham is a big club, with big history and I’m happy to be a part of it now. I can’t wait to get started."
Stoke said they would receive a guaranteed £20 million for the transfer, with a further £5 million in add-ons possibly due.
Arnautovic, 28, joined Stoke from Bundesliga side Werder Bremen for an undisclosed fee before the 2013/14 season, and went on to score 26 goals in 145 appearances for Mark Hughes's men.