Sadiq Khan has been elected the new Mayor of London - boosting Labour after it slumped in Scotland's elections.
Mr Khan is the city's first Muslim mayor, after beating Tory Zac Goldsmith by 1,310,143 votes to 994,614.
The result bolsters leader Jeremy Corbyn after Labour was beaten into third in Scotland by the Tories and lost some English councillors.
In Scotland, the SNP said it would form a minority government after winning its third election in a row.
First Minister Nicola Sturgeon is celebrating what she said was an "emphatic" victory, her first as party leader, after the SNP emerged as the largest party at Holyrood with 63 seats, ahead of the Conservatives on 31 and Labour on 24.
But she played down talk of another independence referendum after falling short by two seats of an overall majority.
In Wales, Labour remains as the largest party, with 29 out of 60 seats, but was denied a majority as Plaid Cymru and UKIP both made notable gains. Counting is continuing in Northern Ireland.
Mr Khan's victory - which gave him the largest personal mandate of any politician in UK history - ends eight years of Conservative control of City Hall. The former Labour MP and minister, 45, becomes London's third mayor after Ken Livingstone and Boris Johnson.
Mr Khan distanced himself from Mr Corbyn during the campaign, pledging to freeze fares on the capital's transport network and build more affordable housing, but also promising to champion business and cut taxes on enterprise.
In his victory speech, he referred to his humble origins on a council estate and said he had never imagined that "someone like me could be elected as mayor of London," promising to be a mayor "for all Londoners".
He said the campaign had not been without controversy, but added: "I am so proud that London has today chosen hope over fear".
He added that the "politics of fear is not welcome in our city".
BBC political correspondent Chris Mason said questions were now focusing on the tone of the Conservative campaign, which was criticised by some within the party and Labour for accusing Mr Khan of sharing a platform with Islamist extremists.
Defence Secretary Michael Fallon - who said during the election campaign that Mr Khan was unfit to be mayor - said it was legitimate to put a candidate under scrutiny.
"Both candidates were asked questions about their backgrounds, their personalities, their judgements, the people they associate with. That's the nature of our democracy and the rough and tumble of politics," he told BBC Radio 4 Today.
Mr Fallon repeatedly declined to say whether he thought Mr Khan was a security risk to London, instead saying: "London is safe with a Conservative government working with the new mayor of London."
Asked if that would require a lot of work, he replied: "Yes, of course it does."
Zac Goldsmith's sister Jemima has criticised how his campaign was run, while former Conservative cabinet minister Baroness Warsi called it an "appalling dog whistle campaign" and former Tory chancellor Ken Clarke said it was a "mistake".
Ms Goldsmith tweeted: "Sad that Zac's campaign did not reflect who I know him to be - an eco friendly, independent-minded politician with integrity."
She also congratulated Mr Khan, calling him a "great example to young Muslims".
David Cameron's former director of strategy Steve Hilton described the Goldsmith campaign as "really weird," claiming it had brought back the "nasty party label to the Conservative party".
Who is Sadiq Khan?
The new mayor did not have a privileged start in life. He was one of eight children born to Pakistani immigrants, a bus driver and a seamstress, on a south London housing estate.
From an early age, he showed a firm resolve to defy the odds in order to win success for himself and the causes important to him.
That resolve has won him the biggest personal mandate in the UK, a job with wide-ranging powers over London and with enormous emotional significance for him.
Some question whether he has the experience or record of good judgement necessary for the role.
He insists he is there to represent all Londoners and to tackle inequality in the capital, and now he has the chance to prove it.
Outgoing mayor Boris Johnson congratulated Mr Khan on "securing a huge mandate to do the best job in British politics" and wished him "every possible success". He also paid tribute to Mr Goldsmith for his "heroic efforts" in the campaign.
Meanwhile, Mr Corbyn led congratulations on Twitter using the hashtag YesWeKhan and told the new mayor: "Can't wait to work with you to create a London that is fair for all."
A Labour victory in the capital was seen as a minimum expectation if Labour leader Jeremy Corbyn was to avoid a full-blown leadership crisis after the party suffered one of its worst ever results in Scotland - losing 13 seats and being pushed into third place by the resurgent Scottish Conservatives.
Mr Corbyn has talked up Labour's performance in Thursday's elections, saying the party had defied predictions by retaining control of councils in the south of England such as Southampton, Hastings, Crawley and Norwich.
"We hung on and we grew support in a lot of places," he said.
Allies of Mr Corbyn, including shadow chancellor John McDonnell and shadow environmental minister Clive Lewis, have called on critics within the party to rally round the leader.
But others, including former shadow minister Michael Dugher, have said Labour was "not on a trajectory to victory" in the next general election, scheduled for 2020.
Labour's vote share is down about 6% on average on 2012 - the last time these seats in England were contested - with 24 fewer councillors. But its share is up 4% on the general election in key wards, with the Conservatives down by a similar amount.
In other election developments:
- Former Tory MPs Neil Hamilton and Mark Reckless are among UKIP candidates elected to the Welsh Assembly
- UKIP gains English council seats, including six in Thurrock, and comes second in two by-elections
- Gill Furniss, the widow of Labour MP Harry Harpham, retains his Sheffield seat in a Westminster by-election
- The Lib Dems gain MSPs in Edinburgh and Fife, take control of Watford Council and add 29 councillors
- Labour wins seats from the Conservatives on the London Assembly
- Liverpool's Labour Mayor Joe Anderson is re-elected
- Shadow home secretary Andy Burnham considers running for newly created role of Greater Manchester mayor
- The Democratic Unionists and Sinn Fein were on course to retain their grip on power at Stormont as the Assembly election count neared its half-way point
- Ex-Labour MP Vera Baird is re-elected as police and crime commissioner for Northumbria, as the 40 results are declared
On the basis of Friday's results, the BBC is calculating that Labour would have got a 31% projected share of the national vote, slightly higher than expected, with the Conservatives on 30%, the Lib Dems on 15% and UKIP on 12%.
In Scotland, Labour gained one seat from the SNP - Edinburgh Southern - but failed to take other targets and was beaten into third place by the Conservatives - a result that would have been unthinkable in the past.
Speaking in Edinburgh, Nicola Sturgeon said the SNP had a "clear and unequivocal" mandate and would govern on its own rather than in alliance with other parties.
On the question of a future vote on independence, she said the SNP would make "its case with passion, with patience but will always respect the opinion of the people".
But Scottish Conservative leader Ruth Davidson, who said any prospect of the issue being reopened in the next five years had been "utterly shredded" by the SNP's failure to win a majority.
In Wales, Labour's vote is down by eight points overall, the Conservative vote is down by three points, while Plaid Cymru is up by two points.
Plaid Cymru leader Leanne Wood celebrated a famous victory after she took the seat of Rhondda from Labour in its south Wales heartlands. Lib Dem Welsh leader Kirsty Williams resigned after her party was reduced to one seat in the Welsh Assembly.
But the biggest story of the night in Wales was the performance of UKIP, which saw its vote increase by 12 points and saw seven candidates elected.
Thursday's polls were the single largest test of political opinion before the next general election, which is scheduled for 2020, with 43 million people entitled to take part.
In total, 2,747 seats in English councils - spanning metropolitan boroughs, unitary authorities and district councils - were up for grabs.
David Cameron said the party's second place in Scotland and its showing in England, where it took control of Peterborough Council and won council seats in key Westminster marginals such as Dudley and Nuneaton, represented a good result for a party which had been in government for six years.
What's still to come (all timings are estimates)
Saturday 7 May
14:00 Results from five remaining councils in England
16:00 Result of Bristol Mayoral contest
Result of elections to Northern Ireland Assembly expected
Sunday 8 May
16:00 Result of elections to Bristol Council (final council in England to declare)
Results of Police and Crime Commissioner elections in Wales