TORONTO -- Vancouver is tops in Canada for quality of life with its moderate climate contributing to its high ranking, says an annual survey.

The West Coast city also has retained its fifth-place spot globally in the 2012 Mercer Quality of Living survey.

Overall, Vienna retains the top spot as the city with the world's best quality of living, also keeping its first place ranking, said the survey released on Tuesday. Baghdad was last out 221 cities.

The survey said Canada offers some of the best quality of living in the world with Ottawa ranking 14th, Toronto 15th, Montreal 23rd and Calgary 32nd.

"One of the things that Vancouver has going for it that the other cities do not is climate," said Mercer Canada's Eleana Rodriguez.

"All four of the other Canadian cities that are on the ranking don't have the kind of climate that Vancouver has, so obviously that's a factor to consider."

Canada has five cities ranked in the top 35 cities in the world, she said, adding that Calgary advanced one ranking and Montreal dropped by one ranking.

"We score quite high," said Rodriguez, market business leader for Mercer Canada in Toronto.

Consulting firm Mercer looked at 39 factors such as a city's political and social environment and its economic and socio-cultural environment, areas in which Canada scored quite well.

The firm also looked at medical and health access, education and access to schools, public transportation, recreation, availability of housing and consumer goods, as well as climate.

"Vienna scores high on a number of those areas," Rodriguez said.

The survey also found that Zurich and the New Zealand city of Auckland were ranked second and third with Munich taking fourth spot.

The annual survey helps multinational companies and organizations compensate employees when they're placed on international assignments.

In the United States, the top three cities were Honolulu, ranked 28th with the highest quality of living, followed by San Francisco in 29th place and Boston at 35th.

Rodriguez said there was little change this year in the rankings for North American cities.

This year, Mercer included a separate ranking for city infrastructure, including access to clean water, electricity telephone, mail, public transport, traffic, and access to an international airport. Singapore ranks highest for infrastructure with Haiti's Port-au-Prince the lowest.

Globally, the cities with the lowest quality of living are: Khartoum, Sudan; N'Djamena, Chad; Port-au Prince, Haiti; and Bangui in the Central African Republic.

"Generally speaking, those cities at the bottom of the ranking are there because of various issues, political and economic in particular, and in some cases socio-cultural issues like political freedom and treatment of women."

Rodriguez said it's not surprising that Baghdad came last.

The Iraqi capital is often hit by car bombings and political strife.

"If I think about risk to life and limb I'd sooner see myself going to Haiti than to Baghdad."