Brazil's presidential election will go to a runoff between Luiz Inacio Lula da Silva, the incumbent, and Geraldo Alckmin, his main rival, the country's electoral commission has said.
Preliminary results on Sunday night show da Silva just short of the 50 per cent of votes needed to win the election outright. A runoff vote will take place on October 29.
Official results showed that with 94 per cent of the vote counted, da Silva had 49 per cent and Alckmin had 41 per cent.
Some votes still remain to be counted by these will not be enough to give da Silva an outright majority.
The tight contest marked a significant shift in the last few days.
Earlier polls showed that da Silva, a former union leader, had been coasting to an outright victory over a field of seven challengers.
But revelations two weeks ago that his campaign staff tried to buy information for a smear campaign against Alckmin gave his opponents new political ammunition.