Portugal's faint hopes of reaching the Euro 2025 quarter-finals ended as they were beaten by Belgium in their final group stage game.
To go through as Group B runners-up, they needed to beat Belgium, and hope Italy lost to Spain with a six-goal swing.
But Belgium, already eliminated after defeats by Spain and Italy, took control after three minutes in Sion as captain Tessa Wullaert turned home a low cross from Jill Janssens.
Though Telma Encarnacao equalised for Portugal with three minutes remaining, Belgium secured all three points through Janice Cayman, who struck deep in stoppage time.
After Portugal went behind early to Wullaert's goal, Ana Capeta passed up two gilt-edged chances to equalise - first failing to lift the ball over Lisa Lichtfus before the break and then failing to beat the Belgium goalkeeper at her near post minutes after the restart.
Portugal were handed a reprieve when Mariam Toloba's goal for Belgium was chalked off for a foul on Andreia Jacinto in the build-up, after referee Tess Olofsson reviewed the incident on the pitchside monitor.
Belgium and Toloba were denied a second again when the striker headed Wullaert's cross against the woodwork before Encarnacao's equaliser.
Amber Tysiak thought she had given Belgium the lead again in stoppage time, only for it be ruled out for offside after a video assistant referee review - but then came Cayman's dramatic winner.
With Spain beating Italy 3-1 in the other fixture, Belgium took third place in Group B with three points - one behind the Italians - while Portugal finished bottom with one point.