Switzerland claimed a narrow 3-2 victory over Serbia to reach the last 16 of the World Cup for the third consecutive tournament.
With a place in the stage of the knockout rounds at stake, an end-to-end first half began with an Xherdan Shaqiri strike that represented his fifth goal in 11 World Cup games.
However, Serbia struck twice in 10 minutes to change the complexion of the contest when Aleksandar Mitrovic's equaliser was followed by a Dusan Vlahovic effort.
Breel Embolo managed to find an equaliser in the 44th minute, ensuring that for the first time since 1998, both teams scored at least two goals before half time in a World Cup game.
Moments after the restart, Remo Freuler swept home what proved to be the final goal of the game to guide his country to a precious victory
Switzerland finish in second place despite being level on six points with Brazil, who lost 1-0 to Cameroon, and as a result, Murat Yakin's side will face Portugal in the last 16 on Tuesday.
Switzerland went into the game knowing that a win would secure their passage in their last 16 and a draw would leave them relying on Brazil picking up a point, while Serbia were well aware that only a victory would give them a chance of advancing.
There have been a number of exciting and dramatic games throughout the final round of the group stage, and the opening exchanges at Stadium 974 suggested another tense match was in store.
Within the opening 30 seconds, Vanja Milinkovic-Savic was forced into a double save to deny Embolo and Granit Xhaka from giving Switzerland an early lead.
Moments later, it was Serbia's turn to go close, as Nikola Milenkovic rose high in the box to head wide from a corner.
Dragan Stojkovic's side continued to press forward in search of the opening goal, and they would have been cursing their luck when Andrija Zivkovic's ferocious strike crashed off the post.
Serbia would have been even more frustrated in the 20th minute when Djibril Sow laid the ball into the path of Shaqiri, who fired the ball in at the near post with the help of a slight deflection.
Their lead only lasted seven minutes, though, as Dusan Tadic picked out the intelligent run of Mitrovic and the Fulham striker produced a sublime glancing header that beat an outstretched Gregor Kobel.
After seeing his strike partner get on the scoresheet, Vlahovic got in on the act to give Serbia the lead, guiding the ball into the corner with a precise left-footed finish.
They may have thought that their lead would at least lasted to half time, but Switzerland had other ideas, clawing themselves back on level terms thanks to Embolo, who slotted home from close range after meeting Silvan Widmer's low cross.
Just three minutes into the second period, Switzerland restored their lead when Freuler guided the ball past Milinkovic-Savic after he was teed up by Ruben Vargas's neat flick.
The pace dropped following Freuler's efforts despite Serbia's best efforts to keep the pressure on their opponents, as they attempted to find an equaliser.
A cagey second period failed to match the gripping drama of the opening 45, and as the contest entered the closing stages, Serbia began to adopt a more direct approach, which ultimately proved fruitless as Switzerland held firm to claim three crucial points.
While Serbia are eliminated after finishing bottom of the group, Switzerland will begin to prepare for their last-16 meeting with Portugal. body check tags ::