Xherdan Shaqiri scored twice as Switzerland beat Turkey 3-1 in Baku to keep their Euro 2020 round of 16 hopes alive.
Liverpool forward Shaqiri gave Switzerland a 2-0 half-time lead after team-mate Haris Seferovic had opened the scoring and added his second after Irfan Can Kahveci's long-range effort for Turkey had reduced the deficit.
The Swiss, beaten 3-0 by Italy last Wednesday after drawing 1-1 with Wales in their opening match, needed to win to stand any chance of progression.
Turkey head home after three straight defeats, having lost to Italy and Wales without scoring in their first two matches.
Seferovic gave Switzerland a flying start, firing home a clinical finish into the bottom corner in the sixth minute.
Shaqiri doubled the Swiss' lead 20 minutes later with a superb curling effort to lift their hopes of completing a five-goal swing and overhauling Wales into second spot.
Turkey got themselves back into the match just after the hour-mark when Kahveci lashed a shot into the top corner from outside the box.
But Switzerland restored their two-goal lead soon after when Shaqiri provided a first-time finish at the end of a sweeping counter-attack.
Eintracht Frankfurt midfielder Steven Zuber provided the assists for all of Switzerland's goals and went close to adding to the scoring himself on three occasions.
Turkey were much improved after two dismal displays against Italy and Wales and Swiss goalkeeper Yann Sommer pulled off a series of fine saves, three of them to keep out first-half efforts from defender Mert Muldur.
Switzerland were also denied on several occasions by outstanding Turkey goalkeeper Ugurcan Cakir as both sides created a combined 41 attempts on goal.
Turkey failed to muster a rousing finale and exit the tournament without a point and just one goal to their name.
Switzerland must now wait for the other groups to be completed before learning whether they qualify for the knockout stages as one of the four best third-placed teams.