Jose Fuenzalida had given the reigning champions the lead inside the opening 10 minutes but Enner Valencia equalised for Ecuador from the penalty spot.
Manchester United forward Sanchez scored the winner after half-time, chipping in a side-footed volley.
Chile finished the game with 10 men after Gabriel Achilier’s late red card.
Sanchez’s goal was his 43rd for his country but it came after he aggravated an ankle injury in the first half.
“I think I have a sprain, I hope it’s not too serious,” he said. “At half-time they strapped it up, I played on with a bit of pain.”
Chile are the second team after Colombia to have qualified for the knockout stages after two games.
Chile top group C with one group game left to play, against Uruguay on Monday, while Ecuador must beat Japan on the same day to stand any chance of progressing.