Voters had to mark a first and second choice on their ballots. Livingstone won 38 percent of the first preference votes to 26.5 percent for Conservative Steve Norris, and won the required majority in the count of second-preference ballots.
Labor mayoral candidate Frank Dobson, Blair's personal pick for the job, finished third with 13 percent of the first-preference vote, a point ahead of the Liberal Democrats' Susan Kramer.
"As I was saying before I was so rudely interrupted 14 years ago," Livingstone quipped, referring to the 1986 abolition of the previous London-wide government, which he headed.
Blair has referred to Livingstone's supporters as a "ragbag of Trotskyists and Tory newspapers." Fearing a Livingstone candidacy, he changed the way Labor Party selected its mayoral candidate to muscle Red Ken out. Dobson, a former Health Secretary, was named the party's standard bearer.
Livingstone was then expelled from the Labor Party for running against Dobson, and broke a public promise not to enter the race as an independent.
Blair's efforts to kill Livingstone's candidacy may have hurt the prime minister more.
"There are a number of voters shocked, horrified and turned off by the way the Labor Party arranged the candidate selection," said Patrick Dunleavy, government professor at the London School of Economics. "It's nothing short of a scandal."
Reacting to Livingstones success at the ballot box, Blair said, "People in London have spoken. We accept their verdict. And we've got to make it work for them."
It appeared to be a bad day all around for Blair, as returns showed Labor losing significant ground to the opposition Conservative Party in Thursday's elections for ore than 3,300 seats on 152 local councils.
The local contests were seen as a referendum on Blair's 3-year-old government.
In London, voters turned against Blair, opting instead for Livingstone and his modest but liberal platform.
In his "manifesto for London," Red Ken called for better pay for police officers, as well as a move toward making London an ecologically sound "sustainable" city
But it didn't comfort the business world when, in an interview last month, Livingstone compared international financial institutions to Adolf Hitler, saying 15 million to 20 million people die each year in developing countries because of the debt burden.
Blair's man Dobson, on the other hand, warned voters of "the cost of Livingstone," slamming Red Ken's tax policy as too expensive.
A socialist since his 20s, Livingstone burst into national prominence in May 1991 by unexpectedly winning the leadership of the Greater London Council, a citywide administration.
By declaring London a nuclear-free city and daring to meet with Sinn Fein leader Gerry Adams before anyone else did, Livingstone was constantly at odds with then-Prime Minister Margaret Thatcher's right-wing Conservatives.
In 1986, Thatcher abolished the council.
Blair resurrected it as part of his program of returning some powers to regional and local governments.
Largely a figurehead, the London mayor will serve as an ambassador for the capital's 7.25 million residents, oversee a $5.3 billion budget and assume responsibility for the police, transportation, fire and emergency services.
The mayor will have only limited tax-raising powers.