Boris Johnson last night notched up the Tories' greatest electoral success since John Major's surprise victory in the 1992 general election when he unseated Ken Livingstone as mayor of London.

Ecstatic Conservatives cheered at London's City Hall, at the end of a count lasting more than 15 hours, as the man who had been dismissed as the Bertie Wooster of British politics took charge of one of the biggest political offices in Britain.

Johnson won just over 1m first preference votes to secure 42.48%; Ken Livingstone came second with 893,877 first preference votes (36.38%); Brian Paddick, the Liberal Democrat candidate, came third with 236,685 votes to give him 9.63%.

Paddick was then eliminated along with the seven other candidates. Their second preference votes were distributed, giving Johnson 1,168,738 votes (53%) and 1,028,966 for Livingstone (47%).

Johnson, who was declared the winner shortly before midnight, reassured London that he would do his best to maintain his new serious image. "I was elected as new Boris and I will govern as new Boris, or whatever the phrase is," he joked this morning in a pun on Tony Blair's famous New Labour declaration. David Cameron quickly hailed the result, and there was even a congratulatory phone call from Michael Bloomberg, mayor of New York.

In a sign of his determination to reach across party lines, Johnson adopted a more serious pose in his acceptance speech as he paid a warm tribute to his defeated rival. Turning to Livingstone, standing behind on a platform at City Hall, the new mayor said: "I think you have been a very considerable public servant and a distinguished leader of this city. You shaped the office of mayor. You gave it national prominence and when London was attacked on July 7 2005 you spoke for London.

"And I can tell you that your courage and the sheer exuberant nerve with which you stuck it to your enemies, especially in New Labour, you have thereby earned the thanks of millions of Londoners even if you think that they have a funny way of showing it today."

Johnson made clear that he still envisaged a role for Livingstone, who had suggested he would have offered his Tory rival a job if he had held office. "When we have that drink together, which we both so richly deserve, I hope we can discover a way in which the mayoralty can continue to benefit from your transparent love of London, a city whose energy conquered the world and which now brings the world together in one city," Johnson said.

Livingstone, who will have to watch as Johnson represents London at the Beijing Olympics in August as the torch is passed over for the 2012 games, apologised for losing after eight years in office. With his voice almost breaking with emotion, Livingstone said: "I'm sorry I couldn't get an extra few points that would take us to victory and the fault for that is solely my own." He said he couldn't be mayor for eight years and then blame someone else for not getting a third term. "I accept that responsibility and I regret that I couldn't take you [Labour supporters] to victory."

Johnson's victory capped a highly successful 24 hours for the Tories, who won 44% of the vote in the separate council elections in England and Wales, convincing many Conservatives that they are on their way to Downing Street. "This is like the March on Rome in 1922," one shadow minister said as Johnson inched towards victory. Johnson will not march into London's City Hall surrounded by blackshirts in the manner of Benito Mussolini's supporters when they staged their coup d'état in 1920s Italy. But the lighthearted reference to 1922 gave a taste of the high Tory spirits.

Johnson's victory was particularly sweet for the Tories because London has been, until relatively recently, hostile territory for the Conservatives, who lost a string of parliamentary seats in the capital in the Labour landslide of 1997. "It is impossible to overestimate the significance of victory," said one senior Tory.

Cameron, who praised Johnson this morning for a "remarkable victory", will reap a huge personal dividend. The Tory leader took what shadow cabinet ministers freely admit was a gamble in throwing his weight behind his fellow Etonian as the best "out-of-the-box" candidate to take on Livingstone.

"David and George [Osborne] made two significant calculations about this contest some time ago," one senior Tory figure said. "They clocked its symbolic importance for us and they realised that a traditional Tory in a pinstriped suit would be trounced by Ken."

Johnson, who announced that he would resign as MP for Henley after organising an "orderly timetable" to choose a new Tory candidate, indicated in his acceptance speech that London had yet to embrace the Tory party fully. "I do not for one minute believe that this election shows that London has been transformed overnight into a Conservative city but I do hope it does show that the Conservatives have changed into a party that can again be trusted after 30 years with the greatest, most cosmopolitan, multi-racial generous-hearted city on Earth on which there are huge and growing divisions between rich and poor."

The Lib Dems will be disappointed that they failed to secure 10% of the vote. Sian Berry, the Green candidate, came fourth with 3.15%. Richard Barnbrook, the British National Party candidate, came fifth with 2.84%. Barnbrook, who was elected to the London assembly, sparked a walkout by the main mayoral candidates when he took to the podium to speak.