Tadic has called for closer ties with the EU while Nikolic advocated turning to Russia instead of the West, which backs Kosovo's majority Albanians in their quest for independence.
"We want to go to Europe. We want to co-operate with the world," Tadic said at a victory rally.
"This is Serbia's victory. I think we have proven both to Europe and everywhere else in the world what kind of democracy we have in Serbia."
On Sunday, the election commission said Tadic had won a projected 50.5 per cent of the vote to Nikolic's 47.9 per cent.
Final results are expected in the early hours of the morning.
Tadic supporters poured on to the streets of Belgrade, the capital, to celebrate, sounding car horns and waving the blue and yellow flags of the Democratic party.
Al Jazeera's Barnaby Phillips in Belgrade said that the mood among Tadic's supporters was one of relief."Their man sneaked home but the size of the opposition vote shows that many Serbs are unhappy with the way their country is being led," he said.
Late on Sunday, Nikolic conceded defeat and congratulated Tadic.
"Tadic won, my congratulations," Nikolic told his supporters. "I would like to call on everyone to stay calm."
"We will be a strong opposition both to the authorities and the president," he told his Radical Party supporters.
The issue of Kosovo had weighed heavily in the elections, although both men had opposed ethnic Albanians' independence drive.
In his victory speech, Tadic restated his commitment to Serbs living in majority ethnic Albanian Kosovo.
|"We give support today to our fellow people in Kosovo and show them that we will never let them down" |
"We give support today to our fellow people in Kosovo and show them that we will never let them down," he said.
The choice of Tadic is likely to mean that Kosovo will wait for a few weeks, in deference to the EU's wishes, before declaring independence.
Kosovo's ethnic Albanian leaders had said they would set the date for their declaration of independence after the election result was announced.
Kosovo has been run by the UN since Nato drove out Serb forces in 1999 to halt ethnic cleansing during a counter-insurgency war.
However, the result could put the survival of the shaky coalition government of Tadic's Democrats and the party of Vojislav Kostunica, the prime minister, in doubt.
Kostunica wants a harder response to Kosovo independence, including diplomatic sanctions against the West, repudiation of the EU and measures to strangle the province economically.
A few days ago, he announced he could not support Tadic's re-election.
Tadic's Democratic Party "will threaten early parliamentary elections and Kostunica will threaten to form a government with [Nikolic's] Radicals", Djordje Vukadinovic, a Serbian political analyst, said.