Sri Lanka held off a West Indies charge at Chester-le-Street on Monday to win an exciting battle of two World Cup also-rans by 23 runs.
Both teams came into the match aware they could not reach the semi-finals but the Caribbean side came close to pulling off the highest successful chase in World Cup history.
Sri Lanka batted brightly to post an imposing total of 338 for six in their 50 overs, thanks largely to Avishka Fernando's first one-day international century.
That total looked beyond the West Indies in the early part of their innings but Nicholas Pooran dug deep, also scoring his maiden ODI ton.
The West Indies found themselves in early trouble at 22-2, with Sunil Ambris and Shai Hope back in the dressing room, both dismissed by veteran fast bowler Lasith Malinga.
West Indies vs Sri Lanka highlights
Chris Gayle flickered briefly but was caught for 35 from a steepling top edge by Jeffrey Vandersay off the bowling of Kasun Rajitha.
Pooran, 23, held the innings together but the West Indies' hopes were badly hit when Carlos Brathwaite was unluckily run out when bowler Isuru Udana diverted the ball into the stumps off his fingertips, with the batsman well out of his ground.
The West Indies looked down and out at 199-6 in the 35th over but Pooran put on 83 for the seventh wicket with Fabian Allen to keep them in the hunt before a second run-out.
The Caribbean side needed 31 runs off the final three overs when captain Dimuth Karunaratne summoned Angelo Mathews to bowl for the first time in an ODI since 2017.
He struck with his first ball, removing a distraught Pooran, who slashed at an innocuous wide delivery and was caught behind by wicketkeeper Kusal Perera.
Earlier, Fernando hit a sparkling maiden ODI century, with all of the top order chipping in to help him.
The 21-year-old reached three figures off exactly 100 balls with eight fours and two sixes but was caught by Fabian Allen off the bowling of Sheldon Cottrell for 104.
Sri Lanka revived their fading hopes of reaching the World Cup semi-finals by beating England but a heavy defeat to South Africa and results elsewhere ended their chances.
West Indies started the tournament with a thumping seven-wicket win against Pakistan but have not won a single match since, with their batsmen in particular letting them down.
Australia are still the only side mathematically certain of their place in the last four, with India, New Zealand and England currently occupying the other top-four slots.
Pakistan and Bangladesh still have a chance of progressing.