London has been ranked as the best city in the world for university students.
The top 30 rankings for student cities, produced by the QS higher education data analysts, has previously put Montreal and Paris in first place.
The ratings are based on factors such as the number of top universities in a city, the local jobs market, the diversity of the culture and the quality of life.
But London ranked poorly on one of the measures - affordability.
The ranking of university cities, rather than the quality of institutions, is produced by the QS higher education group, which publishes the annual World University Rankings.
The comparisons, which include a survey of the views of 50,000 students, are an attempt to quantify some of the attractions and disadvantages of cities for students.
For students in London there is a higher concentration of world-class institutions than in any other city, including Imperial College, University College London, the London School of Economics and King's College.
Students also have access to the cultural life of museums, theatres, cinemas and restaurants.
It is also seen as a good place to connect with employers and get a job.
London achieved a high rating for being a very international city, with high levels of tolerance and diversity, so that overseas students would not feel isolated or excluded.
But when it comes to cost of living and affordability, London does badly, being seen as expensive and difficult for student budgets.
Ben Sowter, research director at QS, says the results show that London "remains a great place to study, despite eye-watering costs".
In second place is Tokyo in Japan, which does very well in terms of the "desirability" of the city. This measures factors such as safety, pollution and quality of living.
Across all cities, Toronto in Canada is rated highest for this desirability, ahead of Tokyo and Amsterdam.
Australia has been pushing for a growing slice of the international market in overseas students and Melbourne is ranked as the third best city for students and Sydney is ninth.
Both the Australian cities perform highly in being outward looking and allowing students to mix, with Canadian and New Zealand institutions scoring highly on this measure.
Edinburgh is Scotland's highest ranked university city in 16th place.
In the academic World University Rankings, US universities dominate, taking all four of the top places in a league table headed by the Massachusetts Institute of Technology.
But there are no US cities in the top 10 student cities, compared with two in Germany, Berlin and Munich. And there are only two US cities in the top 30, Boston and New York.
Paris, which for several years was the top-rated city, has been ranked fifth.
In terms of the most affordable student cities, Budapest in Hungary is rated top, followed by Kuala Lumpur in Malaysia.
A separate annual study, published this week by another part of the QS group, says the two top factors for overseas students were the perceived quality of teaching and whether university locations were seen as "welcoming".
The International Student Survey, based on 67,000 prospective applicants, also warns that 39% of EU students thought that Brexit "has made me less interested in studying in the UK".
They feared that Brexit would make UK universities more expensive and "less welcoming" to students from EU countries.
London's success in the rankings is likely to raise the long-running debate about the UK's attitude towards overseas students and visa requirements.
A study earlier this year from the Higher Education Policy Institute found international students were worth £20bn per year to the UK economy.
London alone gains £4.6bn, said the analysis - with Sheffield the biggest beneficiary in proportion to the size of its local economy.
The think tank said the findings supported calls to remove international students from immigration targets.
The Home Office has argued that there is no limit on the numbers of legitimate students.
Best Student Cities 2018
- Hong Kong
- New York
- Buenos Aires
More from Global education
- Why do young workers have so many more accidents?
- Changing the world, one dinner at a time: Upmarket restaurants compete to be socially valuable
- Can you really revise while chatting online? What does international research say?
- JK Rowling wants to write a happier ending for orphanages
- The lack of a pair of glasses stopping people making a living
- The world's toughest place to study?
The editor of Global education is email@example.com