Spanish Colonial Period

The first recorded visit by Europeans is Ferdinand Magellan's expedition who landed in Homonhon Island, now part of Guiuan, Eastern Samar on March 17, 1521. They lost a battle against the army of Lapulapu, chief of Mactan, where Magellan was killed. Spanish colonialism began with the arrival of Miguel López de Legazpi's expedition on February 13, 1565, from Mexico. He established the first permanent settlement in Cebu Much of the archipelago came under Spanish rule, creating the first unified political structure known as the Philippines. Spanish colonial rule saw the introduction of Christianity, the code of law, and the oldest modern university in Asia. The Philippines was ruled under the Mexico-based Viceroyalty of New Spain. After this, the colony was directly governed by Spain.

Due to conflict with the Portuguese, who blockaded Cebu in 1568, and persistent supply shortages, in 1569 Legazpi transferred to Panay and founded a second settlement on the bank of the Panay River. In 1570 Legazpi sent his grandson, Juan de Salcedo, who had arrived from Mexico in 1567, to Mindoro to punish the Muslim Moro pirates who had been plundering Panay villages. Salcedo also destroyed forts on the islands of Ilin and Lubang, respectively south and northwest of Mindoro. In 1570, Martín de Goiti, having been dispatched by Legazpi to Luzon, conquered the Kingdom of Maynila. Legazpi followed with a larger fleet comprising both Spanish and a majority Visayan force, taking a month to bring these forces to bear due to slow speed of local ships. This large force caused the surrender of neighboring Tondo. An attempt by some local leaders to defeat the Spanish was repelled. Legazpi renamed Manila Nueva Castilla, and declared it the capital of the Philippines, and thus of the entire Spanish East Indies,[14] which also encompassed Spanish territories in Asia and the Pacific. Legazpi became the country's first governor-general.

The Spanish colonial period ended with the defeat of Spain by the United States in the Spanish American War, which marked the beginning of the American colonial era of Philippine history. December 1898, the Treaty of Paris (1898) was signed, ending the Spanish–American War and selling the Philippines to the United States for $20 million. With this treaty, Spanish rule in the Philippines formally ended. On December 21, 1898, President McKinley issued a proclamation of benevolent assimilation. General Otis delayed its publication until January 4, 1899, then publishing an amended version edited so as not to convey the meanings of the terms "sovereignty", "protection", and "right of cessation" which were present in the unabridged version. Meanwhile, on December 26, 1898, the Spanish yielded Iloilo to the insurgents