Shanghai is the largest city by population in China and the largest city proper by population in the world. It is one of the four direct-controlled municipalities of China, with a total population of near 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 at the mouth of the Yangtze River 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 several opened to foreign trade following the British victory over China in the First Opium War and the subsequent 1842 Treaty of Nanking which allowed the establishment of the Shanghai International Settlement. 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 Song Dynasty (AD 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 city in 1927, the area was designated merely as a county seat administered by the Songjiang prefecture.
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.
International attention to Shanghai grew in the 19th century due to European recognition of its economic and trade potential at the Yangtze River. 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, 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 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 (1911–1949), Shanghai's political status was finally 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 governments first task was to create a new city-center in Jiangwan town of Yangpu district, outside the boundaries of the foreign concessions. This new city-center was planned to include a public museum, library, sports stadium, and city hall.
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 International Settlement was 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, which was one of only three former Republic of China (ROC) 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.
During the 1950s and 1960s, Shanghai became an industrial center and center for radical leftism; the leftist Jiang Qing and her three cohorts, together the Gang of Four, were based in the city. Yet, even during the most tumultuous times of the Cultural Revolution, Shanghai was able to maintain high economic productivity and relative social stability. In most of the history of the People's Republic of China (PRC), in order to funnel wealth to the rural areas, Shanghai has been a comparatively heavy contributor of tax revenue to the central government. This came at the cost of severely crippling Shanghai's infrastructural and capital development. Its importance to the fiscal well-being of the central government also denied it economic liberalizations begun in 1978. Shanghai was finally permitted to initiate economic reforms in 1991, starting the massive development still seen today and the birth of Lujiazui in Pudong.