Voter outrage over alleged corruption and dirty tricks left Brazil's president facing a tough runoff for a second term after his main rival staged a surprise comeback.

Polls had predicted that President Luiz Inacio Lula da Silva would trounce the center-right Geraldo Alckmin with far more than the 50 percent plus one vote needed to win the contest in the first round.

But with 99.9 percent of the vote counted by early Monday morning, Silva got 48.6 percent compared to 41.6 percent for Alckmin, the former governor of Sao Paulo state, Brazil's richest and most populous.

CountryWatch: Brazil

It was a stunning setback for Silva.

"Alckmin now has a chance, and a good one," said Alexandre Barros, an analyst with the Brasilia-based Early Warning political risk consulting group.

Alckmin and top Silva aides said they planned a campaign of ideas and issues, but analysts said a brutal period of political attacks is possible, and a beaming Alckmin made it clear that clean government will be one of his central themes.

"Brazil can have an ethical, honest government," he told applauding supporters in Sao Paulo early Monday.

Silva didn't issue any statements from the presidential residence in Brasilia, but top political adviser Tarso Genro said the president only narrowly missed getting an outright win and has always been prepared for a campaign that would lead to a second round.

"We came up just short," Genro said.

Silva's administration has a long history of corruption scandals, having been accused of bribing lawmakers, laundering money, illegal campaign financing and diverting public funds. The scandals have toppled some of Silva's closest aides and much of his party's top brass.

But Silva seemed assured of a first-round victory until two weeks ago when Worker Party operatives were caught allegedly trying to pay $770,000 in cash for information to incriminate Alckmin's Social Democracy Party.

The target of the alleged smear campaign was Jose Serra, an Alckmin ally who won the race Sunday night to become Sao Paulo state's next governor, handily beating the Workers' Party candidate.

Major newspapers ran front-page photos over the weekend showing stacks of banknotes seized in the Worker Party sting. Six Worker Party officials, including an old friend of Silva's who ran his personal security detail, are accused of a scheme to purchase documents, photos and DVDs they apparently thought would link Serra to kickbacks on the purchase of ambulances while he was health minister between 1998 and 2002.

Silva fired his campaign manager days before the election and has denied knowledge of any intent to smear Serra, who denies any wrongdoing in the Health Ministry corruption scandal.

Alckmin said the vote proved his Social Democracy Party is "a party on the rise. We can govern the country better. We can build more sturdy coalitions and push the reforms Brazil needs."

While Silva was also criticized for failing to appear in a presidential debate last Thursday night, the corruption allegations were a deciding factor for many voters.

"I'm not going to tell you who I voted for, because the vote is secret," said Adelaide Venissato, a 53-year-old woman who owns a clothing store. "But I will tell you who I didn't vote for. I didn't vote for Lula. We expected so much and we got very little in terms of security and clean government."

But others seemed willing to overlook the corruption allegations because they feel their lives have gotten better during Silva's four years in office. He has brought a stable economy and social programs that have lifted millions out of poverty.

"I voted for Lula because he worried about workers and the poor," said Waldo Lima Mendonca, a 49-year-old construction worker.

More than 126 million Brazilians voted in the election for the president, governors for all 26 states and the federal district, all 513 federal deputies of the lower house and 27 of the 81 Senate seats.

A poor farmer's son who became a fiery union leader and was later elected as Brazil's first leftist president, Silva surprised many by governing as a moderate once taking office. His deft handling of the economy won him backing on Wall Street and in Brazil's shantytowns. His second-term priorities include reforming the tax and labor rules.

Silva's change in style didn't mean embracing the politics of Washington. He clashed head-on with President Bush over a U.S. proposal to create a continental free-trade area, having termed it a U.S. scheme to "annex" Latin America. Largely because of Brazil's opposition, the free-trade area never took off.

Alckmin is seen as more business-friendly than Silva.