Mr Gayoom thanked the people for allowing him to rule for 30 years
Maldives President Maumoon Abdul Gayoom has conceded electoral victory to opposition leader Mohamed Nasheed.
Mr Gayoom, Asia's longest-serving leader, congratulated Mr Nasheed after final results were confirmed.
Mr Nasheed said his victory, in the nation's first democratic presidential poll, showed the people of the Maldives were embracing the future.
President Gayoom won the first round this month, but failed to secure the 50% needed for outright victory.
With all the votes counted in the second round, Mr Nasheed, a former political prisoner, won 54% to Mr Gayoom's 46%.
"I congratulate Anni [Mr Nasheed's popular name]," Mr Gayoom said in a radio address.
"I thank the people of the Maldives for allowing me to serve them for 30 years.
He promised to ensure a smooth transition from his rule during a rare show of unity held later on Wednesday with Mr Nasheed.
"I want this transition to be a smooth one. I will do everything to work with him (Nasheed)," Mr Gayoom said, calling on his followers to co-operate with the new regime.
The two men jointly addressed the nation from the presidential office just hours after the results from the election were announced and agreed to work together for the good of the people.
"I wish to assure the public and the international community that the transition to democracy in the Maldives will be smooth and uninterrupted in governance," Mr Nasheed said as he shook hands with his former rival.
"A test of our democracy will be how we treat Maumoon."
The outgoing environment minister said the elections had been a "very close race".
Abdullah Mausoom said the country's first "multiparty elections have been held freely and fairly".
The election was the culmination of reforms in the Indian Ocean islands that followed pro-democracy street protests and international pressure.
Mr Gayoom, 71, has ruled the Maldives uncontested since 1978, elected back into office six times by referendums.
The BBC's Roland Buerk in the capital, Male, said Mr Gayoom's supporters had credited him with overseeing an economic expansion fuelled by tourism.
But Mr Gayoom's critics say he was a dictator who ruled like a sultan of old, says our correspondent.