Bronislaw Komorowski declared president of Poland
Bronislaw Komorowski has been officially declared the winner of the Polish presidential election.
According to election officials the acting president won 53.01% of the vote while rival Jaroslaw Kaczynski got 46.99%.
Mr Kaczynski had initially accepted defeat based on an exit poll, but Mr Komorowski's camp remained cautious.
Mr Kaczynski is the twin of former President Lech Kaczynski, who died in a plane crash with 95 others in April.
This run-off election was held after neither candidate gained more than 50% in the first round in June.
At the scene
Yesterday this looked cut and dried. Just 15 minutes after an exit poll put him six points behind, Jaroslaw Kaczynski admitted defeat.
Then, as the results rolled in from the conservative towns and villages in the Polish countryside, it looked as if he might have spoken too soon. By midnight he was ahead.
But as Warsaw and Gdansk reported their votes Mr Kaczynski fell behind again.
Bronislaw Komorowski will now be Poland's new president. But Mr Kaczynski has done far better than anyone predicted given his polarising legacy as prime minister.
Mr Komorowski is from the ruling Civic Platform party, while Mr Kaczynski represents the main opposition Law and Justice party.
The election has been dominated by a catastrophic plane crash. Poland's first couple - along with other leading political and military figures - died when their plane came down in Smolensk on 10 April as they flew to attend a memorial ceremony for the World War II Katyn massacre.
In an address to supporters earlier on Sunday evening, Mr Komorowski appeared optimistic about his chances of victory.
"Tonight we will open a small bottle of champagne and tomorrow we will open a big bottle," he said.
"We thank everybody - the more so that it was an unusual campaign, a difficult campaign held in the shadow of catastrophe," he added.'Return to patriotism'
Urszula Gacek, a former senator from the Civic Platform party, told the BBC's World Today programme that many voters who supported the left-wing candidate in the first round had switched their allegiance to Mr Komorowski in the run-off.
End Quote Jaroslaw Kaczynski
It was due to the work and service of my brother that a new quality in Polish public life emerged”
Jaroslaw Kaczynski, who was prime minister in 2006-2007, initially admitted defeat and said the elections were a "great rehearsal" for regional polls later this year and parliamentary elections in 2011.
"We have to continue changing Poland. We have to continue to be mobilised, we must win," he said.
He paid tribute to his brother, and others who died in the crash, saying: "A movement has emerged from their martyrs' death.
"It was due to the work and service of my brother that a new quality in Polish public life emerged, a return to value, a return to patriotism, everyone in the campaign had to adhere to that," he said.
Mr Kaczynski is seen to have ridden a wave of public sympathy after the tragedy and his popularity has grown considerably.
The BBC's Adam Easton in Warsaw says the result should mean a rare period of political stability for the country, with the prime minister and president from the same party.
Mr Komorowski's party favours market reforms and engagement with Poland's European Union partners.
As president, he would be unlikely to use his power of veto over the government's plans to introduce structural and economic reforms, our correspondent adds.
Mr Komorowski won 41.5% in the first round and Mr Kaczynski 36.5%. Eight other candidates were eliminated.