Haris Seferovic, sent on as a substitute, put the ball in the net for Switzerland in the 93rd minute to salvage what had been a frustrating game for the Swiss side.
The goal came minutes after Ecuador threatened to score at the other end.
Switzerland struggled in the first half when Ecuador scored the only goal.
An unmarked Enner Valencia headed the ball into the net on a corner cross from Walter Ayovi at the 22-minute mark.
In the second half, Admir Mehmedi equalized for Switzerland with a header, just two minutes after walking on the pitch as a substitute.
"Catastrophic" was how a commentator for Swiss broadcaster TSR described Switzerland's game in the first 45 minutes.
But the team showed greater ambition in the second half, even if the Nati missed out on opportunities.
At the 70-minute mark, Josip Drmic put the ball past Ecuador goalie Alexander Dominguez but a linesman flagged it as off-side.
A video replay of the goal indicated the goal should have been allowed.
For Switzerland, ranked sixth best team in the world by Fifa, the victory against 26th-ranked Ecuador was harder come by than expected.
"Hopp Schwiiz!" the traditional rallying cry of supporters became "ouf, Schwiiz".
For coach Ottmar Hitzfeld, the final result clearly came as a relief, gaining the team three points in its Group E, putting it in a good position to advance to the final 16.
Switzerland plays France, who on Sunday beat Honduras 3-0, on June 20th and Honduras on June 25th.
See also: History made as France beat Honduras
Member comments