As both teams pushed forward in search of more goals, Ecuador almost turned the game on its head with an hour played as Valencia's fierce drive flashed narrowly wide of the post.
The Ecuadorians went close again minutes later through Jefferson Montero, but the winger saw his effort pushed behind by Diego Benaglio following a quick break.
While Ecuador looked the more likely to score, Switzerland had a goal controversially disallowed on 70 minutes when Josip Drmic's strike was ruled out for offside. The forward was in an onside position when he received the ball from Rodriguez, but the linesman's flag went up nonetheless.
Ecuador came within inches of snatching the points late on when Benaglio reacted quickly to parry away a deflected free kick, though it was the Swiss who found a late winner as Haris Seferovic capped a dynamic counter-attack by firing in with seconds remaining.