Match ends, Stoke City 2, West Ham United 1.
West Ham must wait to see if they will secure European football next season as Mame Biram Diouf's late header earned Stoke victory at the Britannia Stadium.
Michail Antonio's turn and shot gave Slaven Bilic's side the lead as they totally dominated the first half.
Giannelli Imbula equalised with a 20-yard effort before substitute Diouf powered home a Charlie Adam corner.
West Ham finish seventh and, in order to qualify for the Europa League, need Manchester United to win the FA Cup.
Stoke finish ninth for the third successive season.
Southampton's victory over Crystal Palace ensured they leapfrogged the Hammers.
Hammers will rue missed chances
After the high emotion of Tuesday night's goodbye to Upton Park, West Ham did not appear to suffer any hangover as they created all the chances in the first half - yet still ended up losing.
Knowing a victory would secure at least a sixth-place finish, the visitors took the lead when Antonio held off the Stoke defence at a corner and fired past Shay Given.
The winger then shot over and Diafro Sakho found the side-netting with Stoke, winless in six games, offering no threat of their own.
Mark Hughes' men at least woke up after the break but Sakho should have made it 2-0 when he side-footed at Given after another fine run by the excellent Antonio.
Even after Stoke's equaliser, Given made a brilliant double save from Enner Valencia and Emmanuel Emenike, while Glenn Whelan just about cleared off the line from Cheikhou Kouyate.
The goal review system showed only a tiny fraction of the ball had not crossed the line. On such small margins can European qualification rest.
Stoke recover from slow start
Stoke ended last season with a 6-1 demolition of Liverpool at the Britannia Stadium, scoring five of them in the first half. Here, they managed only one shot in the opening 45 minutes.
It could only get better after the break and, although there was a significant improvement, they were still fortunate to equalise when record signing Imbula picked out the bottom right-hand corner after running across the box.
West Ham had 20 shots to Stoke's seven but the Potters dug in to keep the visitors out as chances mounted up at 1-1.
Substitute Charlie Adam almost repeated his feat of scoring from his own half, as he did against Chelsea in April 2015, but a backpeddling Darren Randolph juggled the ball over at the second attempt.
Diouf's 88th-minute header gave them an unexpected reward and a first win in seven league games.
Man of the match - Michail Antonio (West Ham)
What the managers said
West Ham boss Slaven Bilic: "Basically, the most important thing today was to win no matter how and that we didn't do. We're disappointed to lose sixth place in the last game of the season. But it was still a great season for us. It makes us proud.
"I'd like to congratulate Stoke - they took their chances. But it is hard to take this defeat. For the whole game we played much better football. You have to take 50% of your chances. I said to my players at half-time if it was basketball we would be 20 points clear.
"Despite losing, I'm happy because we played really good football and were totally dominant in a difficult game."
Stoke boss Mark Hughes: "We lost a little bit of confidence, as we have done of late, because we've had a few defeats.
"We just needed to regroup at half-time. It could have been very easy to go long [at 1-0 down] and I think we would have been beaten once again. Credit to the lads: they were brave and played their stuff and, in the end, got their reward.
"We wanted at least a top-10 finish and we knew we would have to work hard to get that."
The stats you need to know
- Stoke are unbeaten in their past six Premier League matches against West Ham (W3 D3).
- West Ham have conceded two or more goals in eight of their past 10 league games.
- Only in 2014-15 have Stoke won more points (54) in a Premier League campaign than in 2015-16 (51).
- Giannelli Imbula ended a run of 11 league games without a goal.
- Only Dimitri Payet (21) has been involved in more league goals for the Hammers this season than Antonio (11 - eight goals, three assists).
- 24GivenBooked at 90mins
- 20CameronSubstituted forBardsleyat 80'minutes
- 21ImbulaBooked at 40mins
- 27BojanSubstituted forAdamat 78'minutes
- 11JoseluSubstituted forDioufat 74'minutesBooked at 89mins
- 5TomkinsSubstituted forMosesat 86'minutes
- 8KouyatéBooked at 20mins
- 15SakhoSubstituted forEmenikeat 61'minutes
- 9CarrollSubstituted forE Valenciaat 67'minutes
- 11E Valencia
- Mike Jones
- Shots on Target
Second Half ends, Stoke City 2, West Ham United 1.
Attempt missed. Darren Randolph (West Ham United) header from the left side of the six yard box is close, but misses to the left. Assisted by Manuel Lanzini with a cross following a set piece situation.
Winston Reid (West Ham United) wins a free kick on the right wing.
Foul by Charlie Adam (Stoke City).
Foul by Winston Reid (West Ham United).
Mame Biram Diouf (Stoke City) wins a free kick on the left wing.
Shay Given (Stoke City) is shown the yellow card.
Foul by Michail Antonio (West Ham United).
Philipp Wollscheid (Stoke City) wins a free kick in the defensive half.
Delay over. They are ready to continue.
Delay in match Jonathan Walters (Stoke City) because of an injury.
Mame Biram Diouf (Stoke City) is shown the yellow card for excessive celebration.
Goal! Stoke City 2, West Ham United 1. Mame Biram Diouf (Stoke City) header from the centre of the box to the high centre of the goal. Assisted by Charlie Adam with a cross following a corner.
Corner, Stoke City. Conceded by Cheikhou Kouyaté.
Corner, Stoke City. Conceded by Angelo Ogbonna.
Foul by Enner Valencia (West Ham United).
Glenn Whelan (Stoke City) wins a free kick in the defensive half.
Substitution, West Ham United. Victor Moses replaces James Tomkins.
Foul by Emmanuel Emenike (West Ham United).