The city was built by Peter I (Peter the Great), who sought an outlet to the sea and a port for trade through the Baltic. It was built in 1703 in what was then Ingermanland, an area conquered from Sweden during the Northern War. The fortress of Peter and Paul was erected to defend the projected new capital, which was to be a modern city and a "window looking on Europe." Construction was carried out at tremendous human and material cost. The capital was moved from Moscow in 1712, although the land on which the city stood was not formally ceded to Russia until 1721. Italian and French architects planned the city, giving it the spacious, classical beauty that it has retained.
St. Petersburg soon replaced Arkhangelsk as Russia's leading seaport and became an important commercial center. From the second half of the 18th cent., it was also the country's principal industrial center, at first for shipbuilding and engineering and later for textiles. In 1851, a rail link with Moscow was completed. One of the world's most brilliant capitals and cultural centers, St. Petersburg was immortalized in the novels of Pushkin, Turgenev, Dostoyevsky, and Tolstoy. Its apex as an international center of literature, music, theater, and ballet and as the scene of lavish and reckless social life was reached in the late 19th and early 20th cent.
Under the surface, however, the seeds of social upheaval ripened, especially among industrial workers. Secret revolutionary societies arose, and an attempt by city workers to petition the czar precipitated a revolution in 1905. The city was renamed Petrograd in 1914. The workers, soldiers, and sailors of Petrograd also spearheaded the revolutions of Feb. and Oct., 1917. Although it lost much of its former glamour, the city remained the economic and cultural rival of Moscow, which replaced it as capital in 1918. Petrograd was renamed Leningrad in 1924. During World War II, the city was cut off from the rest of the USSR by the fall of Schlüsselburg (now Petrokrepost) to the Germans (Aug., 1941). It was besieged for over two years, during which many hundreds of thousands died of famine and disease. The city's original name was restored in 1991. In the 1990s, the city struggled to convert its heavily military-related industries to civilian purposes.