Rio de Janeiro: Brazil's veteran leftist Luiz Inacio Lula da Silva was elected president Sunday by a hair's breadth, beating his far-right rival in a down-to-the-wire poll that split the country in two, election officials said.

The former president, who won a third term in office, stood neck and neck with incumbent Jair Bolsonaro throughout a nail-biting count, however he emerged victorious with 50.83 percent of the vote to 49.17 percent for his rival, according to election authorities who declared him the victor.

All eyes are now on Bolsonaro and whether he will accept the result.