Brazil's leftist President Dilma Rousseff placed first in Sunday's election but did not get enough votes to avoid a runoff and will face pro-business rival Aecio Neves, who made a dramatic late surge to finish a strong second.
After Brazil's most volatile campaign in decades, which saw one candidate die in a plane crash and another soar into first place only to collapse at the end, the result ended up being what was expected a year ago -- a showdown between two arch-rival parties that have governed the country for the last 20 years.
Rousseff will spend the next three weeks fending off an energised Neves, a senator and darling of the investor community who blames her interventionist policies for a long economic slump and proposes free trade and tighter government spending.
Rousseff remains a slight favourite to win, due to her party's strong record of reducing poverty and creating jobs throughout its 12 years in power.
Seeking a second four-year term, she will also try to exploit a widespread perception that Neves' centrist Brazilian Social Democracy Party (PSDB), which governed from 1995 to 2002, is beholden to the rich.
In a speech on Sunday night, Rousseff wasted no time lashing out at the PSDB as the party of "recession, spending cuts and unemployment."
"The Brazilian people don't want ghosts from the past," she said in a hoarse voice.
With 99.9% of votes counted, Rousseff led with 41.6% support compared to 33.6% for Neves.
Marina Silva, a prominent environmentalist who had recently led opinion polls but wilted in the final days under a barrage of negative TV ads and doubts about her shifting positions on issues, came in third place with just 21.3% of votes.
That provided Neves, a popular two-term state governor and the grandson of a beloved politician from the 1980s, a window to present himself as a more reliable alternative.
Still, he immediately set out to woo Silva's voters, who will be critical to deciding the October 26 runoff.
At a raucous celebratory speech, he paused to remember the Brazilian Socialist Party's original presidential candidate, Eduardo Campos, who died in a plane crash on Aug. 13, prompting Silva to take his place. He also pointed out that combining his votes with hers would lead to victory.
"This feeling of change that is widely present in all of Brazil was already victorious in the first round," Neves said.
Nearly 60% of Silva voters said in polls last week they would throw their support behind Neves if he made it into the runoff.
But others who were drawn to Silva's more leftist past will be hesitant to support the PSDB, which implemented important but unpopular pro-market reforms when it ran Brazil from 1995 to 2002.
A nationwide poll by Datafolha released on Saturday showed that, in a runoff, Rousseff would lead Neves by a margin of 48% to 42%. Still, Neves did much better than expected on Sunday and is within striking distance.
When Silva finished third in the 2010 election, she remained neutral. She did not show her cards in her concession speech on Sunday, saying only that members of her coalition would hold meetings in coming days to discuss any endorsements.
MARKET RALLY SEEMS LIKELY
Despite an initially glum mood at her campaign headquarters as results came in, Rousseff voiced optimism and said she could deliver the change Brazilians want after street protests swept the country last year -- while preserving the achievements of recent years, such as low unemployment.
"My second term will be much better than my first," she said.
Neves' strong showing seems likely to spark a rally in Brazil's stocks and currency on Monday. Investors have in recent months bid up assets every time a change in government seems more likely.
"The next few weeks are going to be weeks of intense volatility in the markets," said Paulo Rabello de Castro, chairman of SR Rating, a Brazilian rating agency. "But I really wish I had bought Brazilian assets last week."
After growing at more than 4% a year during a commodities-fueled boom last decade, Brazil's economy has averaged less than 2% growth under Rousseff and many on Wall Street and in Sao Paulo have made no secret of their desire for more market-friendly policies.
Andre Cesar, a political analyst, said Neves appeared to have an even chance at victory. "(Neves) has turned into a very difficult adversary for Rousseff. He has gained muscle and a new energy," Cesar said.
Rousseff counts on bedrock of support among the working class, thanks to generous social welfare programs and the record of her ruling Workers' Party in reducing one of the world's biggest gaps between rich and poor.
Support from her predecessor Luiz Inacio Lula da Silva, who remains by most measures Brazil's most popular politician, will also boost her in the runoff race.
"What's at stake is continuity," said Ana Augusta de Medeiros, a 71-year-old voter in Rio de Janeiro. "I hope they will continue working on behalf of the poor."
Yet others yearn for a change, pointing to poor health care and education services and infrastructure bottlenecks that have made Brazil one of the world's most expensive and difficult places to do business.
"Dilma already tried. The things that she promised she did not complete," said Rosilene Silva de Jesus, 29, who voted for Silva in Sao Paulo.
Because of the topsy-turvy race, campaigning was noisier than usual in a country where the electoral process at times feels more like a carnival.
Candidates employed armies of pamphleteers and flag-wavers at street corners, while campaign jingles, often composed by celebrity musicians, blasted from sound cars and televisions.
This year's frenzy was disrupted when Campos' plane crashed in bad weather along the coast just south of Sao Paulo. Silva rode a wave of public sympathy and her own inspiring, up-from-nothing life story to first place in the polls in early September, but then stumbled badly at the end.