FENGDU, China—This “Ghost City” on the banks of the Yangtze River in southwest China has been reborn.

In legend, Fengdu is where the King of Hell sits in judgment on the souls of the deceased; pilgrims and tourists flock to its temples. Its own day of reckoning came a decade ago when construction of the Three Gorges dam forced all the residents to abandon their homes at the river’s edge and relocate to higher ground in a purpose-built city on the opposite shore. They were reluctant at first, but a short move across a muddy stretch of water catapulted these refugees from an ancient world into modernity.

The new Fengdu quickly filled up and is now bursting with consumer vitality, one of hundreds of small cities wrenched into existence in recent years whose aspiring middle classes have become the single most important engine of China’s economic growth.

Some 20 million people each year swap rural life for an urban one, often in places like Fengdu, which now has 850,000 people, a high-speed rail link, well-stocked supermarkets and at least two (unauthorized) Apple dealers.

About 1,600 small cities account for 40% of China’s 1.3 billion population, 42% of GDP and 35% of retail sales, according to the market research firm Nielsen.