As the votes were counted throughout Friday Mr Khan remained comfortably ahead of Goldsmith and took 1,148,716 votes on the first round to his rival’s 909,755.
As both fell short of the 50% of the vote needed to win, the second preferences of those who’d voted for someone other than the two leading candidates came into play.
After these were redistributed Mr Khan finished the race with 1,310,143 votes to Goldsmith’s 994,614.
The clear win is a personal triumph for the Tooting MP who last summer defeated pollsters’ favourite Dame Tessa Jowell to be chosen as Labour’s candidate.
Over recent weeks the capital’s new mayor found his campaign battling against headlines about Labour’s growing anti-semitism problem as well being faced with efforts to associate him with the “radical” and “extremist” views expressed by a number of people who spoke at events he had attended.
The Goldsmith campaign also targeted London’s ethnic communities with leaflets highlighting what they perceived to be community-specific concerns such as Labour’s support for a wealth tax and Khan’s “failure” to meet Indian Prime Minister Modi in a bid to win over voters.
However Londoners overwhelmingly dismissed these overtures and backed Khan’s vision for London which is heavily informed by his own journey from a south London council estate to human rights lawyer and then to parliament where he served as a minister in two departments.
Delays in declaring the result means Khan will officially take over from Boris Johnson on Monday and is expected to announce key appointments over the coming days.
His win gives Labour only its second ever term in charge of the capital’s £14bn a year government.
Referring to the tone of the campaign, Mr Khan said: “I’m so proud that Londoners have today chosen hope over fear and unity over division” and reiterated his campaign promise to be “a mayor for all Londoners”.
Over the coming weeks he and his new team will set out how they intend to implement and fund a manifesto which includes a four year fares freeze and pledge to ensure that 50% of all new homes are “affordable”.
Despite Labour generally being seen as a Labour city, the party has only held the mayoralty for a single term (2004-08), with Ken Livingstone winning as an independent in 2000 and Boris Johnson winning the first of two terms in 2008.
In a statement, Mr Johnson said: “Many congratulations to Sadiq on securing a huge mandate to do the best job in British politics. I wish him every possible success.
“I believe the high turn out is proof once again that the London mayoralty is now firmly established in the public mind, and I have no doubt the incoming mayor will be able to use the growing powers of the job to deliver improvements in the lives of Londoners.”
Len Duvall, Leader of the London Assembly Labour Group, said: “My congratulations to Sadiq Khan on his historic victory today. Sadiq’s election sends a clear message that Londoners have rejected the divisive dog-whistle campaign waged against him and opted for someone who will get to grips with the challenges they face on a daily basis.
“Throughout his campaign Sadiq has focused on the need for London to remain successful but be affordable for all who live here. His ambitious, exciting and wide-ranging manifesto for the capital has clearly resonated with Londoners who want to see the housing crisis tackled, transport fares made more affordable and quality of life improved.
“I greatly look forward to working closely with Mayor Sadiq Khan to get our city back on track after eight years of damaging drift.”
Speaking at the count, A visibly upset Mr Goldsmith said: “I’m disappointed of course by the result, and that I won’t be able to deliver a manifesto that I’m proud of. A plan to make London the cleanest and greenest city in the world, to keep our city moving and growing, and to keep our city safe.
“I also want to pay tribute to my fellow candidates. In particular I congraulate Sadiq Khan, and I wish him well as he sets out to build on the successes we’ve seen under Boris Johnson.”