Boris Johnson was on course last night to become one of the few Conservative success stories of the local elections.

The flamboyant politician, 47, looked set to win a second term as London mayor, despite a late surge in support for his rival, Labour former mayor Ken Livingstone.

It will be a relief for Downing Street, but raises questions about why Mr Johnson is so much more popular with voters than his party.

Earlier, it had appeared as if Labour might pull off an unexpected coup, winning back control of the UK capital.

Late on, voting appeared to show the pair not quite neck-and-neck, but close enough that second preference votes in the Alternative Vote system for Mr Livingstone, 66, could swing it.

It appeared as if the Johnson juggernaut, which early in the week had led David Cameon to claim you did not have to be Tory to vote for Boris, looked too powerful.

Mr Johnson is already facing intense speculation that he will not stand for a third term and instead will try to return to Westminster, potentially in an election as early as 2015.

It is thought the mayor is convinced he could juggle both running London and representing a Westminster constituency. His surge appeared to buck a trend, with the swing to Labour in the London Assembly mirroring that seen in councils across England.

Labour sources admitted the Livingstone campaign had suffered setbacks and said questions had to be asked over how the politician, 66, became the party's candidate.

His campaign endured a number of embarrassing setbacks, including the revelation that his salary was paid into a private company, leading his opponents to question whether he paid the correct rate of tax, something he has always insisted he did.

The Tories had campaigned in London on Mr Johnson's likeability and his record in office.

Labour, by contrast, had painted the contest as a competition between Labour and Tory values, hoping to capitalise on the wider unpopularity of the Coalition Government.

But an eve-of-voting poll had suggested one in 10 Labour voters intended to choose Mr Johnson over their own party.

Mr Johnson did suffer a setback last night when one of his deputies was ousted after three years.

Richard Barnes lost his seat amid a voter backlash against plans to close a casualty unit at a local hospital.