Intramuros is also called the Walled City, and at the time of the Spanish Colonial Period was synonymous to the City of Manila. Other towns and arrables (suburbs) located beyond the walls are referred to as "extramuros", the Spanish for "outside the walls". It was the seat of government and political power when the Philippines was a component realm of the Spanish Empire. It was also the center of religion, education and economy. The standard way of life in Intramuros became the standard way of life throughout the Philippines
The city was in constant danger of natural and man-made disasters and worse, attacks from foreign invaders. In 1574, a fleet of Chinese pirates led by Limahong attacked the city and destroyed it before the Spaniards drove them away. The colony had to be rebuilt again by the survivors. These attacks prompted the construction of the wall. The city of stone began during the rule of Governor-General Santiago de Vera. The city was planned and executed by Jesuit Priest, Antonio Sedeno and was approved by King Philip II's Royal Ordinance that was issued in San Lorenzo de El Escorial, Spain. The succeeding governor-general, Gómez Pérez Dasmariñas brought with him from Spain the royal instructions to carry into effect the said decree stating that "to enclose the city with stone and erect a suitable fort at the junction of the sea and river". Leonardo Iturriano, a Spanish military engineer specializing in fortifications, headed the project. Chinese and Filipino workers built the walls. Fort Santiago was rebuilt and a circular fort, known as Nuestra Senora de Guia, was erected to defend the land and sea on the southwestern side of the city. Funds came from a monopoly on playing cards and fines imposed on its excessive play. Chinese goods were taxed for two years. Construction of the walls began on 1590 and continued under many governor-generals until 1872. By the middle of 1592, Dasmarinas wrote the King about the satisfactory development of the new walls and fortification. Since the construction was carried on during different periods and often far apart, the walls were not built according to any uniform plan.
Improvements continued during the terms of the succeeding Governor-Generals. Governor-General Juan de Silva executed certain work on the fortifications in 1609 which was improved by Juan Niño de Tabora in 1626, and by Diego Fajardo Chacón in 1644. The erection of the Baluarte de San Diego was also completed that year. This bastion, shaped like an "ace of spades" is the southernmost point of the wall and the first of the large bastions added to the encircling walls, then of no great height nor of finished construction. It was the former site of Nuestra Señora de Guia, the very first stone fort of Manila. Ravelins and reductos were added to strengthen weak areas and serve as outer defenses. A moat was built around the city with the Pasig River serving as a natural barrier on one side. By the 18th century, the city was totally enclosed. The last construction works were completed by the start of the 19th century.