During the Spring and Autumn Period, Shanghai belonged to the Wu State. During the the Period of the Warring States, Shanghai first belonged to the Yue State and then to the Chu State.
During the Warring States Period (475 -221BC), Huang Xie, known as Lord Chunshen of the Chu state, organized people to excavate the Huangpu River. The river therefore has a nickname of 'Chunshen River' and Shanghai has sometimes been referred to as 'Shen' ever since. Fishermen living in the area at that time created a fishing tool called Hu, so Shanghai has the other nickname of 'Hu'.
During the Qin Dynasty (221 - 206BC) Shanghai was not even a town. People used boats in the former Mao Lake and the rivers of today's Songjiang District to trade and do business.
From the Han Dynasty (206BC - 220AD) on the industries of coin-casting, metal-smelting and salt-production grew dynamically in the Shanghai area and the economical connection between this area and the hinterland gradually strengthened. Prosperity continued into the Jin Dynasty (265 - 420).
In the Sui (581 - 618) and the Tang (618 - 907) Dynasties the Shanghai area enjoyed rather fast progress, as great importance was attached to the economic development of southern China. The area became an important bread basket, thanks to proper reclamation of arable land. After this the area gathered a larger population by degrees and it had more economical and cultural exchange with places at home and abroad.
In 751 during the Tianbao Years of the Tang Dynasty, Huating County was established in today's Songjiang District of Shanghai, the heart of which is now in the Huatinghai area in northeast Huating County. However at that time, Shanghai had not yet developed its position as a major port. During the Tianbao Years, Qinglong County had the busiest port, owing to its advantageous location at the mouth of the Wusong River. Ships departing from its port could sail to other cities along the inland rivers, coastal cities and even Japan and Korea. Later, the silting of the Wusong River made ships desert the port of Qinglong County, giving Shanghai a good opportunity for growth.
During the Northern Song Dynasty (960 - 1127), Shanghai, with its excellent port and shipping conditions, gradually replaced Qinglong County as a center of trade. Residential areas formed and the former fishing village became a small town.
In 1267 during the Southern Song Dynasty (1127 - 1279), Shanghai Town was officially established, under the jurisdiction of Huating County. Due to increasing trade, a swarm of merchant ships gathered in the port of Shanghai, making it more and more prosperous.
During the Yuan Dynasty (1271 - 1368) one of the country's seven Maritime Trade Offices was set up in Shanghai Town. In 1292 Shanghai County was set up in today's Minhang District. The economy thereafter saw even greater development, especially in the planting of cotton and the textile industry. Advanced cotton-spinning tools and techniques were introduced into Shanghai to promote the industry.
By the Ming Dynasty (1368 - 1644) Shanghai had already grown into the largest cotton spinning base in China. Its textiles were popular at home and abroad. With 'Sha Chuan' (the general name of sea-going junks from Shanghai) as the main conveyance, the shipping industry, another mainstay of the economy of Shanghai, was also well-developed. A great number of shops and restaurants appeared, making Shanghai a busy, well-known busy city.
In 1685 during the Qing Dynasty (1644 - 1911), the Customs Office was established in Shanghai. Consequently unprecedented progress was made in the shipping industry including freshwater carriage, Yangtze River shipping, coastal liners and international shipping. The port of Shanghai came to handle the largest quantities of imported and exported cotton cloth. Many ships berthed in the port, making it the main transfer point of maritime trade. As time passed, Shanghai gained its position as an important economic power, a water transport center and an international trading port in China
In 1840 Shanghai County had already grown to include today's Huangpu District and the old city zone, bordering today's Qingpu District in the west, Chuansha Town in today's Pudong New Area in the east, Baoshan District in the north and Nanhui District in the south.