Hakan Yakin's double strike ensured that Switzerland ended their Euro 2008 campaign on a high at the expense of Group A table-toppers Portugal.
After a goalless first half, Yakin gave Switzerland the lead when he slotted in through the legs of keeper Ricardo.
He scored his second, and third of the championship, with a firmly struck penalty after Fernando Meira fouled substitute Tranquillo Barnetta.
Portugal's Pepe had a shot saved and Nani hit the outside of the upright.
Portugal coach Luiz Felipe Scolari blamed himself for the defeat: said: "I made a big mistake. I should have made 11 changes. But I thought we would play normally.
"I just couldn't have imagined that the group would have ended this way."
Scolari added: "I made a calculation. I tried to see what players had been playing more during the season, how many had been injured.
"That's why I decided to replace eight, to try to keep a certain amount of consistency that could help the squad.
"We had a few opportunities. But we didn't score a goal to give us an advantage and later we will see the consequences of this.
"I should have been more careful and replaced 11 rather than eight players."