Luiz Inacio Lula da Silva was elected Brazil’s president in a dramatic comeback for the left-wing politician who was languishing in a jail cell just three years ago on corruption charges.

He defeated incumbent Jair Bolsonaro by less than 2 percentage points in Sunday’s runoff vote, according to the official tally. It signals a change in direction for Latin America’s largest economy after a heated campaign that showed extreme polarization among the electorate, and marks the first time a sitting president in Brazil has lost a re-election bid.

U.S. President Joe Biden quickly congratulated da Silva, who is often referred to only as Lula, on his victory. Brazil’s lower house Speaker Arthur Lira did the same, saying the "will of the majority must not be challenged.”