QUITO, Ecuador—President Rafael Correa has watched one after another of his leftist Latin American allies get impeached, beaten at the polls or excoriated as antidemocratic, as his own government faced growing disenchantment amid an economic downturn.

This week, he hailed a reversal in that trend as Ecuadoreans elected his preferred successor, former Vice President Lenin Moreno, in a tight race against a conservative rival. The outcome, he said, highlighted the left’s resilience at a moment when analysts see the region’s politics...