Initially, Shanghai sounded less than appealing to American Andrea Duty. When her husband Chris told her that his company had offered him a position in the city, she didn’t even want to discuss it.

My first reaction was: absolutely not

“My first reaction was: absolutely not,” Duty recalled several months later, munching on imported Spanish cheese in a Tapas bar in the heart of Shanghai.

Two months after their move, the couple is in love with Shanghai, and, like many foreigners, they can reel off an almost endless list of reasons for it.

Shanghai is the largest and most cosmopolitan city in China, and its glamour has long been a draw for foreigners from all over the world. For more than 150 years, people from overseas have found a home away from home here. Then and now, it’s opportunity that drives them to settle here.

But China’s recent economic woes have meant fewer expats are establishing themselves in the country. Reports indicate the number of foreigners in the city was around 255,000 around a year ago, a drop of 2% versus 2014.

Economic growth slipped to just under 7% last year, the stock market has been volatile and rich Chinese are seeking ways to get their money out of the country. In recent years some foreign companies have become more pessimistic about their operations in China, and started to replace foreigners in top positions with foreign-educated Chinese. In 2014, twice as many expats moved out of the China than into it, a study by UniGroup Relocation found.

Although everyone is waiting for the economic bubble to burst, China’s financial capital is still a very attractive option for workers looking for an exciting overseas assignment. Foreigners still see Shanghai as a chance to either further their career in ways they couldn’t at home, or to make money quickly. For many, it’s both.

Making money

“Expats here have an interesting opportunity because it’s still such a boomtown, and many are moving in,” said Duty, an American chef who is working on a cookbook on French regional pastries.

I do find it more financially comfortable than living in London or in New York

Most expats don’t find life in Shanghai all that expensive — perhaps because expat incomes are high. In China, foreigners make an average of about $158,000 a year, compared to a global average of just over $104,000, HSBC’s 2015 Expat Explorer survey found.

Many professionals work in management positions, and are paid premiums to make the big leap here, despite relatively greater cultural hurdles and worsening air pollution. Some are even offered a pollution hazard pay.

Over the past few years, air pollution levels have worsened in Shanghai. On some days, the air is deemed “very unhealthy” but it hardly ever reaches the “hazardous” levels Beijing residents are struggling with.

But the glitz and the many comforts of living in Shanghai have their price, a recent survey by corporate consultants ECA International found. In terms of cost of living, Shanghai has surpassed other Asian metropolises and takes the top rank as the continent’s most expensive city for expats.

The survey only compared consumer goods and services, and did not consider housing or income, but other studies, too, show that the city of more than 24 million can be one of the world’s most expensive.

Life in Shanghai can be very affordable

But other than paying for pricey home comforts such as dairy products or fresh produce, life in Shanghai can be very affordable, at least compared to Hong Kong. Lunch in Western restaurants is typically less than $10, an amount that would also get you a taxi across the city. If you get on the extensive and modern subway system, you’ll hardly ever pay more than $1.

“For us, our cost of eating went down, the cost of groceries, the cost of transportation... I do find it more financially comfortable than living in London or in New York,” Duty said.

Not only is their disposable income higher than when they lived in the West, but, barring air pollution, their way of life has improved.

The Dutys now pay similar monthly rent as they did in London, but their apartment is much more spacious, spreading over two floors with a furnished living room and kitchen.

There are pitfalls for house hunters, as many agents are unreliable and some listings are fake

Finding a home was quick and easy for the Dutys, but there are pitfalls for house hunters, as many agents are unreliable and some listings are fake. Real estate agents usually come referred by co-workers or friends who have already lived in Shanghai.

Where to settle

“It’s a great place for foreigners,” said Carlby Xie, China research director for real estate firm Colliers International.

Overall, the vibe is cosmopolitan and modern, and the general attitude toward foreigners is friendly.

Housing, however, is the biggest concern for foreigners, and rents vary widely depending on location. Generally, Colliers found that rents cost about $29 a square metre, but expats often pay much more because to them, location matters, Xie said.

Long-term expats complain that expenses have skyrocketed in just a few years. The days are long past when a modern, centrally located, one-bedroom apartment would cost no more than 3,000 yuan (about US$450 per month). Prices have more than doubled, depending on the area.

The former French Concession in downtown Shanghai is one of the most popular locations, featuring fancy mansions with gables, spires and steeples. A small studio here will cost $1,200 per month or more. For young foreigners with little work experience, that can be as much as two-thirds of their salary, said Xie.

Bring the kids

From the French Concession, a couple of subway stops under the Huangpu River will take you to Puxi, where ritzy skyscrapers butt up against each other. It’s where families often live in serviced apartments close to international private schools.

Schools are plentiful but expensive. Tuition for a child starts around $1,500 per month, depending on age and school, and a serviced apartment with enough room for a small family starts around $3,500 a month.

It doesn’t matter if they are Germans, Brits, Australians or Singaporeans, they come to Shanghai to make money

Most of that isn’t paid by expats directly, though.

“If you came with a company and you work at an executive level, you are entitled to a package and they pay for your housing and so on, so you can save a lot,” Xie said.

And even if they didn't, tuition and cost of rent won’t break the bank. At least a quarter of expatriates in China make more than $300,000 a year, the highest proportion in any country HSBC surveyed.

“It doesn’t matter if they are Germans, Brits, Australians or Singaporeans, they come to Shanghai to make money. Some of them stay for two to five years, depending on their adaptability, and when they have saved enough money, they return back home and invest in real estate.”

Jobs and regulations

Managers, bankers, engineers, IT professionals, architects, designers and other highly skilled and experienced foreigners will always find well-paid jobs in Shanghai.

Marketing, sales, events, PR and branding are sectors with jobs where less experience is required. Searches on LinkedIn and expat websites with job and apartment listings like SmartShanghai will get you results for those positions where headhunters aren't involved. Preference will be given to those who speak basic Mandarin, and putting an effort into studying it will pay off not just when it comes to job hunts. The Shanghainese are incredibly helpful — and often impressed — if foreigners speak the littlest bit of Chinese.

If you do plan to move to Shanghai and have found a job here, don’t start packing right away. The visa process can be quite gruelling, although companies handle everything. To get a Z visa, which allows you to properly work for a company in Shanghai, you need several documents and certificates, from birth certificate to a health check including testing for sexually transmitted infections.

The application can take several months and regulations change frequently.

Living it up

Many expats in Shanghai ride an overly crowded subway to work, eat a bowl of dumpling soup from a hole-in-the wall spot for lunch and marvel over elderly men playing Chinese chess in parks.

But what also makes this city so popular for foreigners is that any comfort they know from home is just around the corner.

You also know that Starbucks and good Italian food is just around the corner. It’s a really nice blend of East and West

“You also know that Starbucks and good Italian food is just around the corner. It’s a really nice blend of East and West,” said Maura Cunningham, a Philadelphia native who lived in Shanghai for two years while working on her dissertation.

She spent half of her $2,000 a month on her apartment and tailored the rest of her budget to what she could afford. Even with a limited budget, Cunningham could use Shanghai as a base to explore other places in China and in Asia.

Using high-speed trains, it takes about five hours to get to Beijing, and one hour to get to other major cities in the Yangtze River Delta. Japan is an inexpensive two-hour flight away, and for around $300, the tropical islands of Southeast Asia invite for diving and cocktails on sandy beaches.

Cunningham may not have been able to invest in real estate when she moved back to the US, but her work in Shanghai and her language skills set her up for a job as a programme officer with the National Committee on US-China Relations.

It’s the common factor for expats in Shanghai that they might move only to further their career and boost their incomes. But most find themselves really enjoying life here.

“I was only there for two years, but I miss it. It’s as much home as Philadelphia,” Cunningham said.

To comment on this story or anything else you have seen on BBC Capital, head over to our Facebook page or message us on Twitter.