Opposition candidate Adama Barrow hailed a "new Gambia" after he pulled off a stunning presidential election victory, putting an end to the 22-year rule of Yahya Jammeh.
Jammeh -- who has been frequently accused over the years of suppressing his opponents -- conceded defeat on television, accepting that Gambians had "decided that I should take the backseat".
Official results earlier showed Barrow, a businessman and political unknown until six months ago, comfortably winning Thursday's poll with 45.54 percent, capping a remarkable rise to prominence.
Jammeh took 212,099 votes (36.66 percent) and third party candidate Mama Kandeh 102,969 votes (17.80 percent), the Independent Electoral Commission said.
Gambians took to the streets to celebrate the biggest upset in the west African nation since Jammeh seized power in a 1994 coup.
In Westfield, a district near the capital, teenagers piled on top of cars, taking selfies and strumming guitars, while others waved flags coloured the grey of the opposition coalition.
In his first comments afterward, Barrow acknowledged the nation's huge shift.
"It's time for work. It's a new Gambia," he said.
Barrow was chosen as the opposition flag bearer by a group of political parties who joined forces for the first time and won unprecedented popular support.
Turnout was around 65 percent.
Speaking to the public on Gambian television, Jammeh congratulated Barrow for his "clear victory", adding: "I wish him all the best and I wish all Gambians the best."
Jammeh, who once said he would govern for a billion years if God willed it, was attempting to win a fifth term, but said the result was a decision from the divine that he would respect.
"I will never cheat or dispute the election because this is the most transparent, rig-proof elections in the whole world," he added, referring to The Gambia's unique system of voting with marbles dropped into coloured drums.
Barrow will now serve a three-year term at the head of a transition reform government in the tiny ex-British colony that occupies a narrow sliver of land surrounded by French-speaking Senegal.
Jammeh has 60 days to leave office, according to the Gambian constitution.
The election was marked by an internet blackout that sparked condemnation from rights groups and the United States.
Security forces had deployed heavily in Banjul earlier Friday amid nervousness over whether Jammeh would accept defeat, but by the end of the day the officers were shaking hands with Barrow supporters.
"Never before has power changed hands (in The Gambia) through the ballot box," said US State Department Spokesman John Kirby, acknowledging the stunning result.
"We encourage all Gambians to respect the election results and the government of Gambia to respect the rights of citizens to freely assemble as they respond to the results."
"The United States congratulates the people of The Gambia on a peaceful and democratic presidential election that has the potential to mark a new beginning for all Gambians," National Security Council spokesman Ned Price said.
UN Secretary General Ban Ki-moon sent his congratulations to Barrow and commended Jammeh's message to the president-elect.
At his final campaign rally, Jammeh had warned that protests over the election result would not be tolerated, saying The Gambia "does not allow" demonstrations.
"It is a stunning day... emancipation day for Gambians. We have had 22 years of illegal arrests and suppression from Yahya Jammeh," said Maya Darboe, whose husband, head of the opposition United Democratic Party (UDP), was jailed in July for attending a protest.
The regional body ECOWAS, the UN and the African Union all hailed a "free, fair and transparent presidential election", and Jammeh for "gracefully conceding defeat".
There were no international observers present for the election, which passed off smoothly with a diplomatic team overseeing some limited monitoring.
A Senegalese security source confirmed to AFP in Dakar that The Gambia had closed its borders for the election, a common occurrence during elections in west Africa.
Jammeh's tenure was marked by his surviving multiple attempts to remove him from the presidency.
Some 60 percent of the population live in poverty in The Gambia, and a third survive on $1.25 (1.20 euro) or less a day, according to the UN.