Goldsmith, MP for Richmond Park, declared his intention to stand last June while Khan, despite hinting as early as 2013 that he might run, was not selected as Labour’s candidate until September last year after he beat rival Tessa Jowell to the nomination.
Khan, a former solicitor, made one of his first pledges in November, telling voters he would freeze all London transport fares for four years if he became Mayor.
Despite criticism of the policy from Transport for London, which claimed it had not been properly costed, Khan showed he was tapping into one of the top issues that Londoners care about.
Londoners care about transport and housing
A Brandwatch analysis for PRWeek of more than 316,000 London-based tweets about the mayoral race - between 1 January and 3 May - showed that transport and housing were the joint top topics of conversation among Twitter users, with about 16,000 mentions, followed by security and policing with nearly 9,000 tweets.
Following his early announcement about public transport, Khan was swift to identify, then capitalise on, the lack of affordable housing.
The MP for Tooting recognised the anger of Londoners over foreign investors buying homes in new developments, only to leave them unoccupied.
This was unacceptable, Khan argued, because it drove prices up further for those who need to live and work there.
Khan says he will give Londoners first dibs on new builds in the capital and will link rents for new homes to average local incomes.
Official figures show private-sector rents in London are up from nearly 50 per cent to 62 per cent of average pre-tax income since 2010, and a recent PWC report estimates that 60 per cent of Londoners will be renters by 2025.
By comparison, Goldsmith’s pledges to build 50,000 homes by 2020 and to fund 500 more police on the Tube, as well as to freeze council tax for four years, looked decidedly lacklustre.
But while his pledges failed to ignite the electorate, Goldsmith’s tactics cut through for all the wrong reasons.
His attempt to position Khan as friend to extremists, after he shared a platform with London imam Suliman Gani, led to accusations of racism, Islamophobia and ‘dog-whistle’ tactics against his opponent.
The final straw came the weekend before polling day when the Mail on Sunday ran a comment piece by Goldsmith with the headline, "On Thursday, are we really going to hand the world’s greatest city to a Labour Party that thinks terrorists are its friends?" alongside an image of the bus that was bombed during London’s 7/7 attacks.
Although Goldsmith later distanced himself from the use of the image with his article, the damage was done.
Polling data since January showed growing support for Khan while Goldsmith’s numbers deteriorated. YouGov polls in the first three months of the year showed Khan holding steady on 31 per cent while Goldsmith slipped from 24 per cent to 20 per cent.
ComRes polls for April and early May show a similar story, with Goldsmith on 37 per cent, against Khan’s 44 per cent, falling to 36 per cent in the week before polling.
A final YouGov poll on polling day showed Khan on 57 per cent against Goldsmith’s 43 per cent, which was mirrored in the final result.
Hope over fear
As soon as the polls closed on Friday night, senior Tories, including the leader of the Conservative group on the Greater London Council, spoke out about the negative impact of Goldmsith's campaign.
Andrew Boff said the campaign had "blown up bridges" the party had built with London's Muslim communities.
In his victory speech at the weekend, Khan claimed that Londoners had chosen "hope over fear" by voting against Goldsmith’s negative campaign.