Jammeh had conceded defeat, the chairman of the Independent Electoral Commission (IEC) said as Gambians began to take to the streets to celebrate the biggest upset in the west African nation since Jammeh seized power in a 1994 coup.
"It's really unique that someone who has been ruling this country for so long has accepted defeat," Alieu Momar Njie told reporters.
AFP / Paz PIZARRO
Barrow won 54.54 percent (263,515 votes) while Jammeh took 36.66 percent (212,099) and third party candidate Mama Kandeh 102,969 votes (17.80 percent) in the Thursday poll, the IEC said.
Turnout was around 65 percent.
Jammeh, who once said he would govern for a billion years if God willed it, was attempting to win a fifth term with his Alliance for Patriotic Reorientation and Construction (APRC).
On the streets of Bakau, a district on the outskirts of the capital Banjul, Gambians began an impromptu street party, drumming, dancing and honking car horns.
"This man (Jammeh) beat and oppressed us," a young man who gave his name as Jawara told AFP. "We didn't have our freedom but definitely Barrow will give it to us," he added, choking back tears.
Gambian state television told AFP that Jammeh would make a statement later in the day to congratulate opposition leader Barrow, 51.
A previously unknown estate agent and former economic migrant to Britain, Barrow was chosen as the opposition flag bearer by a group of political parties who had joined forces for the first time, whipping up unprecedented popular support.
Barrow told AFP before the vote was announced that he was "certain" he had won.
If Jammeh's concession is confirmed, Barrow will likely 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 and pristine Atlantic ocean beaches beloved by tourists.
- Banjul success -
Jammeh campaign manager Yankuba Colley said he was not aware of the electoral commission chairman's statement but said he believed the president would step down if the Gambian people wanted it.
"When the Gambians make their verdict, he is someone who is faithful," he told AFP.
"It is a difficult result but the man I know will accept whatever comes."
Barrow's camp confirmed the IEC statement.
Gambian opposition leader Adama Barrow greets supporters on November 29, 2016
Thursday's election was marked by an internet blackout that sparked condemnation from rights groups and the United States.
But early results on Friday were positive for Barrow as he took the capital Banjul -- a traditional Jammeh stronghold.
He won nearly 50 percent of the vote in Banjul's three constituencies, according to the IEC, compared to 43 percent for Jammeh.
Security forces had deployed heavily in Banjul earlier Friday amid nervousness over whether Jammeh would accept a ballot box defeat.
Before dawn broke, military and police, some covering their faces, set up checkpoints every few hundred metres on the outskirts of the capital, while citizens were inside sleeping or watching the results come in.
"Power belongs to the people. You cannot stop us and you cannot stop them," Barrow said at his final rally this week.
Jammeh meanwhile had predicted the biggest landslide of his political career.
- 'Generally peaceful conditions' -
The United States said turnout appeared to be high and that the vote took place in "generally peaceful conditions", while the IEC hailed "a very successful election."
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.
AFP / MARCO LONGARI
A woman leaves a voting booth at a polling station in Banjul on December 1, 2016
No professional international observers were on the ground for the vote, diplomats confirmed, but a small team of African Union experts monitored events along with Banjul-based US and European delegations already present in the country.
A Senegalese security source confirmed to AFP in Dakar that The Gambia had closed the borders on Thursday, a common occurrence during elections in west Africa.
Jammeh seized power in a 1994 coup and had until now survived 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.