Independent candidate Chadchart Sittipunt, 55, won the election by a record 1.3 million votes while his nearest rivals both captured about 250,000 votes, according to the unofficial result announced by the Election Commission.
The poll is the first governor race since 2013, with 31 candidates seeking to win the support of the capital's 4.4 million eligible voters, including 700,000 first-time voters.
Bangkok is the only province in Thailand to elect its own governor every four years since 1985, though the process was suspended when former military junta leader Prayuth came to power in the 2014 coup.
Prayuth won a 2019 general election that critics say was flawed. The Thai government has rejected the accusations and said the poll was free and fair.
Since July 2020 Prayuth has been the target of the biggest anti-government protests in years.
Chadchart, who was among the prime minister candidates for the opposition Pheu Thai Party in the 2019 election, said his victory on Sunday showed the power of the democratic process and vowed to heal political differences as he takes on the city's top job.
"I am ready to be the governor for everyone ... we have to get beyond divisions and be united to take Bangkok forward," he said.
Thitinan Pongsudhirak, a political analyst at Chulalongkorn University, said that Chadchart's victory demonstrates declining support for the Prime Minister's conservative government.
"Chadchart's landslide victory is an indictment against all that has transpired since the May 2014 military coup," said Pongsudhirak.
"It's a protest vote against the mismanagement and ineptitude of the military regime since."
Chadchart's rivals conceded defeat on Sunday, though it could be a week or more before the Election Commission declares the official result.
A government spokeswoman declined to comment on the Bangkok governor election.
(Reporting by Panu Wongcha-um and Panarat Thepgumpanat; Editing by David Goodman)