Voters in Latin America's largest democracy are set to elect a new commander-in-chief on Sunday, in what many consider to be the most important presidential election since the country returned to democracy three decades ago. The campaign trail has been particularly dramatic. Brazil's current front-runner is recovering from a near-fatal stabbing, the country's most popular politician is serving a 12-year prison sentence, while a massive corruption scandal has exacerbated widespread distrust among the electorate. Sunday's ballot presents voters with a choice between far-right candidate Jair Bolsonaro and leftist rival Fernando Haddad. CNBC takes a look at what's at stake for Brazil ahead of the vote.

Who's going to win?

Leading the presidential race is Bolsonaro — a pro-dictatorship former military officer who has been dubbed the "Trump of the Tropics" by the country's media. The 63-year-old populist, who has expressed his admiration for President Donald Trump, has won support by promising to jail corrupt lawmakers and make it easier for the police to shoot drug traffickers. His rival in the second-round run-off vote is Haddad, a former Sao Paolo mayor who has taken the baton from leftist icon Luiz Inacio Lula da Silva. Lula was imprisoned in a corruption scandal in April, subsequently becoming ineligible to seek a return to public office. This then paved the way for Haddad to run as leader of the Workers' Party, promising a return to the days when — under Lula's premiership — Brazil enjoyed eight years of economic boom from 2003 to 2011.

Brazil's right-wing presidential candidate for the Social Liberal Party (PSL) Jair Bolsonaro gives his thumbs up after casting his vote at Villa Militar, during general elections, in Rio de Janeiro, Brazil, on October 7, 2018. FERNANDO SOUZA | AFP | Getty Images

"This election is very much an unbeauty contest and really more of a case of who will be rejected the least," Robert Wood, a Brazil analyst at the Economist Intelligence Unit, told CNBC via telephone interview earlier this week. "Having said that, barring any last-minute shocks, Bolsonaro is going to win," Wood said. Bolsonaro emerged victorious in the first round at the start of the month, securing more than 49 million votes to Haddad's 31 million. But, having enjoyed a comfortable projected lead over Haddad in the weeks that followed, the gap between them has narrowed. A Datafolha poll published by the Folha de S.Paulo newspaper found Bolsonaro is expected to win around 56 percent of vote, compared to Haddad's 44 percent. A week ago, the same poll put Bolsnoaro on almost 60 percent of voter support.

Why is pension reform a 'timebomb' for Brazil?

The presidential election comes at a time when the South American country is still reeling from a massive corruption scandal, with a record number of Brazil's political representatives facing criminal cases. The scandal has been so divisive, nearly half of voters have suggested they would never consider supporting either Bolsonaro or Haddad. Nonetheless, Bolsonaro — who is seen as the more market-friendly candidate despite previously admitting ignorance over a range of economic issues — has thrived by claiming to be a clean-living lawmaker determined to drain the political swamp. Analysts say that aside from the enduring corruption scandal dominating the headlines, the "elephant in the room" is pension reform. "It is a timebomb for Brazil," Carlos Caicedo, senior principal analyst for Latin America at IHS Markit, a London-based research firm, told CNBC via telephone interview this week. "The question is whether the next president will have the appetite and the support in congress to change things."

Brazil's presidential candidate for the Workers' Party (PT), Fernando Haddad gestures during a meeting with a group of evangelical pastors, in Sao Paulo, Brazil, on October 17, 2018. NELSON ALMEIDA | AFP | Getty Images

Caicedo said Bolsonaro's plans to tackle pension reform in the country are "extremely vague" and lack any kind of discernible detail. Whereas, Haddad "does not seem to understand the seriousness of the problem either." Pension reform is a thorny issue in the Latin American country. It is disliked by many voters who fear their retirement age could be pushed back, while lawmakers wrestle with an urgent need to balance public accounts.

What about environmental issues?

Brazil is home to approximately 60 percent of the Amazon, one of nature's best natural defences against climate change. So much so, the world's largest tropical rainforest is often referred to as the lungs of the Earth. Yet, according to country's political frontrunner, its current environmental policy is "suffocating the country." Bolsonaro has even suggested that, if elected, he would be prepared to align himself with Trump and pull Brazil out of the Paris climate agreement. "Bolsonaro's environmental message has been designed to placate the rural lobby and encourage support among the 'beef, bullets and bible' caucus," EIU's Wood said. The "beef, bullets and bible" caucus refers to an influential political group in Brazil, which groups together the farm lobby, lawmakers determined to relax stringent firearms controls and evangelical Christians. Several of Bolsonaro's policies have alarmed environmentalists, including his commitment to scrap the environment ministry and refusal to set aside forest land for native Brazilians who have lived in the Amazon for centuries.

An overview of the dense canopy and deforestation in the Amazon rainforest outside Manaus, Brazil. Per-Anders Pettersson | Getty Images

"It raises questions of Brazil's stewardship over the Amazon but during Bolsoanro's honeymoon period, I don't know if there would be too much to gain by pulling out of the Paris climate accord," Wood said. Bolsonaro has since said he would not take Brazil out of the Paris accord, as long as he received assurances the country would not need to cede its sovereignty.

How will markets react?