The earliest known human remains found in the Philippines are those of the pre-Mongoloid Tabon Man of Palawan carbon dated to around 24,000 years ago.[17][18] Negritos were another group of early inhabitants but their appearance in the Philippines has not been reliably dated.[19] They were followed by speakers of Malayo-Polynesian languages who began to arrive beginning around 4000 BCE displacing the earlier arrivals.[20] By 1000 BCE the inhabitants of the archipelago had developed into four kinds of social groups: hunter-gathering tribes, warrior societies, petty plutocracies, and maritime centered harbor principalities.[21]
The maritime oriented peoples traded with other Asian countries during the subsequent period bringing influences from Hinduism, Buddhism, and Islam. There was no unifying political state encompassing the entire Philippine Archipelago. Instead, the islands were divided among competing thalassocracies ruled by various datus, rajahs, or sultans. Among these were the kingdoms of Maynila, Namayan, and Tondo, the rajahnates of Butuan and Cebu, and the sultanates of Maguindanao and Sulu.[22][23][24][25] Some of these societies were part of the Malayan empires of Srivijaya, Majapahit, and Brunei.[26][27] Islam was brought to the Philippines by traders and proselytizers from Malaysia and Indonesia.[28] By the 15th century, Islam was established in the Sulu Archipelago and by 1565 had reached Mindanao, the Visayas, and Luzon.[29]
In 1521, Portuguese explorer Ferdinand Magellan arrived in the Philippines and claimed the islands for Spain.[30] Colonization began when Spanish explorer Miguel López de Legazpi arrived from Mexico in 1565 and formed the first European settlements in Cebu. In 1571, after dealing with the local royal families in the wake of the Tondo Conspiracy and defeating the Chinese pirate warlord Limahong, the Spanish established Manila as the capital of the Spanish East Indies.[31][32]
Spanish rule contributed significantly to bringing political unity to the archipelago. From 1565 to 1821, the Philippines was governed as a territory of the Viceroyalty of New Spain and then was administered directly from Madrid after the Mexican War of Independence. The Manila galleons linking Manila to Acapulco traveled once or twice a year between the 16th and 19th century. Trade introduced foods such as corn, tomatoes, potatoes, chili peppers, and pineapples from the Americas.[32] Roman Catholic missionaries converted most of the lowland inhabitants to Christianity and founded schools, a university, and hospitals. While a Spanish decree introduced free public schooling in 1863, efforts in mass public education mainly came to fruition during the American period.[33]
During its rule, the Spanish fought off various indigenous revolts and several external colonial challenges from Chinese pirates, the Dutch, and the Portuguese. In an extension of the fighting of the Seven Years' War, British forces under the command of Brigadier General William Draper and Rear-Admiral Samuel Cornish briefly occupied the Philippines. They found local allies like Diego and Gabriela Silang who took the opportunity to lead a revolt against the Mexican-born acting Governor-General and Archbishop of Manila Manuel Rojo del Rio y Vieyra, but Spanish rule was eventually restored following the 1763 Treaty of Paris.[28][34][35]
In the 1800s, Philippine ports were opened to world trade. Many criollos and mestizos became wealthy. The influx of Spanish and Latino settlers secularized churches and government positions traditionally held by the peninsulares. The ideals of the French Revolution also began to spread through the islands. Criollo dissatisfaction resulted in the revolt in Cavite El Viejo in 1872 that was a precursor to the Philippine Revolution.[28][36][37][38][39]
Revolutionary sentiments were stoked after colonial authorities executed the three priests, Mariano Gómez, José Burgos and Jacinto Zamora (collectively known as Gomburza), who were accused of sedition, in 1872.[36][37] This would inspire a propaganda movement in Spain, organized by Marcelo H. del Pilar, José Rizal, and Mariano Ponce, lobbying for political reforms in the Philippines. Rizal was eventually executed on December 30, 1896 on charges of rebellion.[40] As attempts at reform were meeting with resistance, Andrés Bonifacio in 1892 established the secret society called the Katipunan, a society along the lines of the freemasons, which sought independence from Spain through armed revolt.[38] Bonifacio and the Katipunan started the Philippine Revolution in 1896. A faction of the Katipunan, the Magdalo of Cavite province, eventually came to challenge Bonifacio's position as the leader of the revolution and Emilio Aguinaldo took over. In 1898, the Spanish-American War began in Cuba and reached the Philippines. Aguinaldo declared Philippine independence from Spain in Kawit, Cavite on June 12, 1898 and the First Philippine Republic was established the following year. Meanwhile, the islands were ceded by Spain to the United States for $20 million dollars in the Treaty of Paris. As it became increasingly clear the United States would not recognize the First Philippine Republic, the Philippine-American War broke out. It ended with American control over the islands.