Shanghai is the largest Chinese city by population and the largest city proper by population in the world. It is one of the four direct-controlled municipalities of the People's Republic of China, with a population of more than 24 million . It is a global financial center, and a transport hub with the world's busiest container port. Located in the Yangtze River Delta in East China, Shanghai sits on the south edge of the mouth of the Yangtze in the middle portion of the Chinese coast. The municipality borders the provinces of Jiangsu and Zhejiang to the north, south and west, and is bounded to the east by the East China Sea.
For centuries a major administrative, shipping, and trading town, Shanghai grew in importance in the 19th century due to European recognition of its favorable port location and economic potential. The city was one of five opened to foreign trade following the British victory over China in the First Opium War while the subsequent 1842 Treaty of Nanking and 1844 Treaty of Whampoa allowed the establishment of the Shanghai International Settlement and the French Concession. The city then flourished as a center of commerce between east and west, and became the undisputed financial hub of the Asia Pacific in the 1930s. However, with the Communist Party takeover of the mainland in 1949, trade was reoriented to focus on socialist countries, and the city's global influence declined. In the 1990s, the economic reforms introduced by Deng Xiaoping resulted in an intense re-development of the city, aiding the return of finance and foreign investment to the city.
Shanghai is a popular tourist destination renowned for its historical landmarks such as The Bund, City God Temple and Yu Garden as well as the extensive Lujiazui skyline and major museums including the Shanghai Museum and the China Art Museum. It has been described as the "showpiece" of the booming economy of mainland China.
During the Spring and Autumn period, the Shanghai area belonged to the Kingdom of Wu, which was conquered by the Kingdom of Yue, which in turn was conquered by the Kingdom of Chu. During the Warring States period, Shanghai was part of the fief of Lord Chunshen of Chu, one of the Four Lords of the Warring States. He ordered the excavation of the Huangpu River. Its former or poetic name, the Chunshen River, gave Shanghai its nickname of "Shen". Fishermen living in the Shanghai area created a fishing tool called the hu, which lent its name to the outlet of Suzhou Creek north of the Old City and became a common nickname and abbreviation for the city.
During the Song dynasty (960–1279) Shanghai was upgraded in status from a village to a market town in 1074, and in 1172 a second sea wall was built to stabilize the ocean coastline, supplementing an earlier dyke. From the Yuan dynasty in 1292 until Shanghai officially became a municipality in 1927, central Shanghai was administered as a county under Songjiang Prefecture, whose seat was at the present-day Songjiang District.
Two important events helped promote Shanghai's development in the Ming dynasty. A city wall was built for the first time in 1554 to protect the town from raids by Japanese pirates. It measured high and in circumference. During the Wanli reign (1573–1620), Shanghai received an important psychological boost from the erection of a City God Temple in 1602. This honour was usually reserved for places with the status of a city, such as a prefectural capital not normally given to a mere county town, as Shanghai was. It probably reflected the town's economic importance, as opposed to its low political status.
During the Qing dynasty, Shanghai became one of the most important sea ports in the Yangtze Delta region as a result of two important central government policy changes: In 1684, the Kangxi Emperor reversed the Ming dynasty prohibition on oceangoing vessels – a ban that had been in force since 1525; and in 1732 the Yongzheng Emperor moved the customs office for Jiangsu province (; see Customs House, Shanghai) from the prefectural capital of Songjiang to Shanghai, and gave Shanghai exclusive control over customs collections for Jiangsu's foreign trade. As a result of these two critical decisions, by 1735 Shanghai had become the major trade port for all of the lower Yangtze region, despite still being at the lowest administrative level in the political hierarchy.
International attention to Shanghai grew in the 19th century due to European recognition of its economic and trade potential at the Yangtze. During the First Opium War (1839–1842), British forces occupied the city. The war ended with the 1842 Treaty of Nanjing, which allowed the British to dictate opening the treaty ports, Shanghai included, for international trade. The Treaty of the Bogue signed in 1843, and the Sino-American Treaty of Wanghia signed in 1844 forced Chinese concession to European and American desires for visitation and trade on Chinese soil. Britain, France (under the 1844 Treaty of Whampoa), and the United States all carved out concessions outside the walled city of Shanghai, which was still ruled by the Chinese.
The Chinese-held old city of Shanghai fell to the rebels of the Small Swords Society in 1853 but was recovered by the Qing government in February 1855. In 1854, the Shanghai Municipal Council was created to manage the foreign settlements. Between 1860–1862, the Taiping rebels twice attacked Shanghai and destroyed the city's eastern and southern suburbs, but failed to take the city. In 1863, the British settlement to the south of Suzhou Creek (northern Huangpu District) and the American settlement to the north (southern Hongkou District) joined in order to form the Shanghai International Settlement. The French opted out of the Shanghai Municipal Council and maintained its own concession to the south and southwest.
Citizens of many countries and all continents came to Shanghai to live and work during the ensuing decades; those who stayed for long periods – some for generations – called themselves "Shanghailanders". In the 1920s and 1930s, almost 20,000 White Russians and Russian Jews fled the newly established Soviet Union and took up residence in Shanghai. These Shanghai Russians constituted the second-largest foreign community. By 1932, Shanghai had become the world's fifth largest city and home to 70,000 foreigners. In the 1930s, some 30,000 Jewish refugees from Europe arrived in the city.
The Sino-Japanese War concluded with the Treaty of Shimonoseki, which elevated Japan to become another foreign power in Shanghai. Japan built the first factories in Shanghai, which were soon copied by other foreign powers. Shanghai was then the most important financial center in the Far East. All this international activity gave Shanghai the nickname "the Great Athens of China"
Under the Republic of China (1912–49), Shanghai's political status was raised to that of a municipality on 14 July 1927. Although the territory of the foreign concessions was excluded from their control, this new Chinese municipality still covered an area of , including the modern-day districts of Baoshan, Yangpu, Zhabei, Nanshi, and Pudong. Headed by a Chinese mayor and municipal council, the new city government's first task was to create a new city center in Jiangwan town of Yangpu district, outside the boundaries of the foreign concessions. The "Greater Shanghai Plan" included a public museum, library, sports stadium, and city hall, which were partially constructed when the plan was interrupted by the Japanese invasion.
On 28 January 1932, Japanese forces struck and the Chinese resisted, fighting to a standstill; a ceasefire was brokered in May. The Battle of Shanghai in 1937 resulted in the occupation of the Chinese administered parts of Shanghai outside of the International Settlement and the French Concession. The foreign concessions were occupied by the Japanese on 8 December 1941 and remained occupied until Japan's surrender in 1945, during which time war crimes were committed.
On 27 May 1949, the People's Liberation Army took control of Shanghai. Under the new People's Republic of China (PRC), Shanghai was one of only three municipalities not merged into neighboring provinces over the next decade (the others being Beijing and Tianjin). Shanghai underwent a series of changes in the boundaries of its subdivisions, especially in the next decade. After 1949, most foreign firms moved their offices from Shanghai to Hong Kong, as part of a foreign divestment due to the Communist victory.