Sadiq Khan thanked the voters of London for "making the impossible possible" by electing him to be London's first Muslim mayor Friday.
Election officials confirmed late Friday that the 45-year-old Labour Party politician won the bitterly fought election over Conservative Zac Goldsmith and will succeed Boris Johnson.
"Thank you London. London is the greatest city in the world," Khan said after the victory.
Khan received 57 per cent after second preferences were taken into account; Goldsmith finished with 43 per cent, according to news reports.
He will be the first mayor from the Labour Party in eight years.
"I am so proud of our city. I'm deeply humbled by the hope and trust you've placed in me today. I want to say thank you to every single Londoner for making the impossible possible today," Khan said.
He described a "burning ambition for London" to ensure that every Londoner has the opportunities that the city gave him and his family, "opportunities not just to survive, but to thrive."
Labour leaders, Conservative rivals and foreign politicians congratulated Khan as the outcome became clear.
Several politicians and a Muslim group criticised Goldsmith's focus on Khan's religious background, and his claim that the former human rights lawyer had associated with extremists.
Shuja Shafi, the head of the Muslim Council of Britain, said it was "unfortunate that a Londoner who happens to be Muslim, and has gone out of his way to repudiate extremists, has nevertheless been smeared with the extremist brush."
Labour's Diane Abbott, who became one of London's first black members of parliament in 1987, accused the Conservatives of running "the most appallingly anti-Muslim campaign."
"They threw everything at him but Sadiq Khan's resilience and talent helped make history today," Tom Watson, Labour's deputy leader, said on Twitter.
French Prime Minister Manuel Valls congratulated Khan on Twitter and said he was looking forward to welcoming him in France.
In other regional elections across England and Wales, the Labour Party avoided the heavy losses that many analysts had feared, but the centre-left party lost further ground in its former political heartland of Scotland.
"Across England we had predictions we'd lose councils," Labour leader Jeremy Corbyn told supporters in Sheffield, where Labour won a by-election for the national parliament.
"We didn't [lose]," Corbyn said. "We hung on and we grew support in some places ... because our party is standing up against the grotesque levels of inequality in Britain."
The party retained important seats even in the traditionally Conservative south. However, it suffered further losses to the ruling Scottish National Party (SNP) in the Scottish Parliament, sliding to third place amid a Conservative revival north of the border.
The SNP retained its position as the dominant party in Scotland's regional parliament but failed to maintain its outright majority after losing several seats.
Gains made by British Prime Minister David Cameron's Conservative Party pushed Labour into third place in Scotland.
Cameron said the strong showing in Scotland would allow the Conservatives to "stand up to the SNP and give Scotland strong opposition."
The elections for regional and local assemblies have been seen as Corbyn's first test in national polls.
The leftist became Labour leader last year, and critics have expressed doubts over his ability to unite the party.
Labour's share of the vote fell significantly compared to regional and local elections in 2011 and 2012, but it appears to have regained some footing after a disastrous result in the general election last year, which gave the Conservatives a majority in parliament.
Meanwhile, the right-wing UK Independence Party, which is campaigning heavily for Britain to leave the European Union in a June 23 referendum, made gains in local councils in England and won its first seats in the Welsh regional assembly.