Costa Rica were already eliminated from the World Cup while Switzerland were still fighting for a place in the Round of 16 when the two sides met on Wednesday evening.
However, it was the Central American side which dominated the early encounters, that was until the Swiss stole an undeserving lead in the 31st minute.
Stephan Lichtsteiner broke free from a defender on the right-hand side before floating in a fantastic cross for Breel Embolo.
Embolo, who was tightly marked, cleverly nodded the ball onto his team-mate Dzemaili, who then smashed a volley into the roof of the goal to give Switzerland a 1-0 lead.