Rio De Janeiro, Brazil (CNN) -- Brazil's ruling party candidate Dilma Rousseff garnered the most votes in Sunday's presidential election but fell short of the majority she needed to avoid a runoff.
With 99.98 percent of the votes counted, Rousseff led the race with 46.9 percent of the vote, according to the Superior Electoral Court. She needed 50 percent plus one vote to avoid a second-round runoff.
She will now face Jose Serra, a former mayor of Sao Paulo and one of the county's most experienced politicians. He had 32.61 percent of the vote, the court said.
If she ultimately prevails, Rousseff -- a former Marxist guerrilla -- would be her country's first female president. The runoff election is scheduled for October 31.
"Thank you very much to all of you, and tomorrow we will again continue the conversation that we have been having since the beginning of this electoral campaign," Rousseff said soon after the count, according to video on Bandeirantes television.
Sunday's general election spanned across all levels of government, from local offices to the presidency. Nine candidates vied for the nation's top job.
Rousseff is the hand-picked successor of President Luis Inacio Lula da Silva, who has an 80 percent approval rating. The outgoing president has steered Brazil into a major global economy, and his choice for the next president appears to be influencing voters.
The president is barred from running for a third consecutive term.
Brazil has the world's eighth-largest economy, which has grown 7 percent a year on the strength of a commodities boom and market-friendly policies.
And the country will get more worldwide attention in the coming years, hosting events such as the World Cup in 2014 and the Olympics in 2016.
Voting is mandatory in Brazil for anyone over age 18 and under age 70. Some 136 million people were eligible to vote.
CNN's Shasta Darlington and Umaro Djau contributed to this report.