Millions of Brazilians are choosing between two very different politicians to be their next president.
Far-right candidate Jair Bolsonaro is facing leftist Fernando Haddad of the Workers' Party in the second and final round of presidential elections.
While his poll lead has narrowed, Mr Bolsonaro remains in the lead.
The election has been overshadowed by corruption scandals and a knife attack on Mr Bolsonaro in which he lost 40% of his blood and needed emergency surgery.
Read more about the election dividing Brazil:
Who are the candidates?
Jair Bolsonaro, a 63-year-old former army captain, is from the small, conservative Social Liberal Party. His provocative statements on abortion, race, migration, homosexuality have earned him the nickname "Trump of the Tropics".
He replaced former President Luiz Inácio Lula da Silva, currently serving a 12-year prison sentence on corruption charges, as the presidential candidate for the Workers' Party less than a month before the first round of the election.
What do they stand for?
One of Mr Bolsonaro's flagship campaign issues has been to increase security for Brazilian citizens. He has portrayed himself as a hardliner who will restore safety to Brazil's streets, indicating that his government will aim to relax laws restricting the ownership and carrying of guns.
His economic policy plans include proposals to reduce government "waste" and promises to reduce state intervention in the economy.
He has also said that he will "cleanse" Brazil of corrupt politicians, and that Brazil could pull out of the 2015 Paris Agreement on climate change.
Fernando Haddad has campaigned on a promise to make Brazil a more inclusive country for all its citizens. He said that if elected his government would invest in the public sector to stimulate the economy.
As a former education minister, it comes as little surprise that Mr Haddad argues that making education accessible to all should be a key priority. He argues this approach would be the best way to narrow the wide gap between the rich and poor in Brazil.
"Every human being has to get up and have a destination, whether that is the university, a school, day care for their child, a workplace, a dignified job, a small business," he said in a radio interview.
Who is likely to win?
Two final opinion polls released on Saturday showed that support for Mr Haddad had increased, though Mr Bolsonaro was still expected to win about 55% of the vote.
"This thing is going to turn around," Mr Haddad told supporters at his final campaign rally.
Mr Bolsonaro made his final pitch on social media. He has not campaigned in public since he was stabbed in the stomach at a rally in September, sending him to hospital for three weeks.
"God willing, tomorrow will be our new independence day," he tweeted.
What is the atmosphere like?
By BBC South America Correspondent Katy Watson
We have spent the day at a couple of voting centres in Rio. The first was in the upmarket neighbourhood of Leblon, next to the iconic Ipanema beach. There were quite a few people dressed in the "colours" of their candidate - green, blue and yellow in support of Jair Bolsonaro, red for those voting for Fernando Haddad.
Most voters came and went in peace but a group of Bolsonaro supporters started heckling those voting for Haddad.
"Go to Venezuela you socialists," they shouted at those supporting the Workers' Party.
At the voting centre in Rocinha, a poor neighbourhood, very few displayed their political allegiances. Hardly anyone would talk to us, hesitant to declare their vote. There has been so much anger and division in these elections, and the tension just continues to build.
Why is there so much anger?
Outgoing President Michel Temer has an approval rating of only 2%, so many Brazilians are hungry for political change.
They say they are fed up with the corruption scandals which have seen dozens of high-ranking politicians and influential businesspeople go to jail over the past few years
Mr Bolsonaro - who says he will root out corruption, although he has given few details as to how he plans to do this - has benefited from this anger directed at the established political parties.
Many of those who said they would cast their vote for him said they would do so because they did not want to see the Workers' Party return to power.
But Mr Bolsonaro's rhetoric and his misogynistic, racist and homophobic comments have alienated many Brazilians who fear that his far-right policies could undermine Brazil's democratic institutions.
There have been mass rallies for and against Mr Bolsonaro and the divisions run deep, sometimes even within families.