RIO DE JANEIRO (AP) — If anything, Dilma Rousseff is a survivor.
The former political prisoner-turned-president approaches the end of her first term having lived through cancer, endured raucous, anti-government protests in 2013, brushed past critics to pull off a successful World Cup, and held onto wide support even as Brazil's economy sputtered into recession.
Sunday's presidential election determines the outcome of, perhaps, her most surprising challenge yet: the unexpected rise of Marina Silva, a popular Amazon-born environmentalist who was thrust into the presidential race when a plane crash killed her party's top candidate.
The twists and turns leading up to Latin America's largest election have been the sort of drama even writers of the nation's popular soap operas would have hesitated to invent. How it will end is up to Brazil's electorate of nearly 143 million people.
"It's been the most unpredictable election since the reinstatement of democracy in 1985," said Paulo Sotero, director of the Brazil Institute at the Woodrow Wilson International Center for Scholars in Washington.
Just weeks ago, Rousseff's chances of survival looked dim, with polls suggesting she and Silva would advance to a runoff vote that Silva was likely to win. But Rousseff fought back aggressively by raising doubts about Silva's qualifications, and support for the high-flying challenger slipped.
Polls released Saturday by Brazil's two leading firms, Datafolha and Ibope, showed Rousseff leading Neves and Silva by about 20 percentage points in Sunday's election, although she appeared to fall short of winning the outright majority she would need to avoid a runoff on Oct. 26.
The Social Democracy Party candidate Neves is an economist and former governor of Minas Gerais, Brazil's second-most populous state, who has strong name recognition. His grandfather, Tancredo Neves, was a widely beloved figure who was chosen to become Brazil's first post-dictatorship president but fell ill and died before taking office.
Datafolha's survey published Saturday showed Neves and Silva in a technical tie considering the poll's margin of error as they headed into Sunday's vote, 26 percent to 24 percent. An Ibope poll on Saturday had 27 percent for Neves and 24 percent for Silva, also with a 2 percentage point margin of error.
Both polls suggest Rousseff likely would beat either challenger in a runoff.
Voters will cast ballots via electronic machines Sunday and results are expected to be known within hours of poll closing at 5 p.m. local time (6 p.m. EDT, 2200 GMT in the country's far west). Voting is mandatory for Brazilians aged 18 to 70, and optional for those as young as 16 or over 70. Organizers dispatched some 530,000 voting devices to reach even far corners of the country, the fifth-largest in the world. Officials in jungle villages deep in the Amazon had machines sent in by boat.
Rousseff Workers' Party has held the presidency since the 2002 election of her predecessor and mentor, Luiz Inacio Lula da Silva.
On Saturday, Rousseff campaigned hard in Neves' home state, where she's held a surprising advantage in polls, while Marina Silva focused her efforts on reversing her falling support in Sao Paulo. Neves shadowed Rousseff, making stops in Minas Gerais in search of every crucial vote that could propel him into a runoff.
Rousseff promised to continue strong state involvement in the economy, even though critics complain it creates a poor business environment and the main stock market tumbled every time a new poll showed Rousseff on the rise.
The Workers' Party has the support of many in the lower classes due to social programs that helped move 40 million people into the middle class since 2003 and take several million others out of extreme poverty. While the economy has been stagnant under Rousseff, unemployment remains at historic lows.
Nevertheless, it was discontent among the newly minted middle class that fueled demonstrations last year when millions of Brazilians took to the streets, paralyzing the nation for two weeks, to demand better health care, schools, transportation and security.
"Brazil is a country that has isolated itself because of its protectionist trade policy. It has lost ground in the economic area but at the same time created this middle class, a modest middle class, but one that is very numerous," Sotero said. "They've seen the Promised Land and now they want to get there, and they'll continue to pressure whoever leads the government."
Silva, for her part, has surrounded herself with a more centrist economic team that wants to give independence to the Central Bank and look for opportunities beyond the region's frail trade bloc, Mercosur. She wants Brazil to seek bilateral trade deals with Europe and the U.S., streamline government spending and push political reforms in an effort to lessen corruption. Critics say Silva, who represents the Socialist Party, wants to both invoke austerity and expand popular social programs without saying how they would be bankrolled.
Many admire the convent-educated Silva, who overcame childhood illness and poverty to rise in politics. She served 16 years in the Senate and more than five years as environment minister, crafting the policies that curtailed deforestation of the Amazon.
"It's going to be a tough choice," said Vania Oliveira, a 29-year-old newsstand vendor in Rio who said she's leaning toward voting for Silva but had yet to fully commit.
"Dilma and the Workers' Party have been in power for so long, and they have helped so many people. But it's tempting to vote for Marina because we now need to deepen the advances," she said. "We need better health care, education and security. We've gained a lot — but we want more."
Follow Brad Brooks on Twitter: www.twitter.com/bradleybrooks