Early polities in what is now the Philippines were small entities known as barangays, although some larger states were established following the arrival of Hinduism and Islam through regional trade networks. The arrival of Spanish settlers began a period of Spanish expansion which led to the creation of the Captaincy General of the Philippines, governed out of Manila. While technically part of New Spain, the Philippines functioned mostly autonomously. The reliance on native leaders to help govern led to the creation of an elite class known as the principalia. Spanish control was never firmly established over much of its claimed territory, with some inland and Islamic regions remaining effectively independent.

The 19th century saw a significant social change, and the development of a distinct Filipino identity among the mestizo elite. Members of the educated Ilustrado class, influenced by liberal ideas, launched the Propaganda Movement. Rejection by Spanish authorities led to a national awakening, the emergence of an independence movement, and a revolution which became entwined with the Spanish–American War. While the revolutionaries declared independence, Spain ceded the Philippines to the United States in 1898. Through the subsequent Philippine–American War and later actions, the United States established effective administration over the entire archipelago and introduced political structures that reflected those of the United States.

The pre-existing elite was entrenched within the new political system, and the dominant Nacionalista Party steadily gained more control over its institutions. In 1935 the autonomous Commonwealth of the Philippines was established, giving the Philippines its own constitution and a powerful President. Plans for independence were interrupted by Japanese invasion during World War II. The Japanese established the nominally independent Second Philippine Republic, but American and Allied reconquest restored the Commonwealth and led to full independence in 1946. This period saw the emergence of a two-party system, with the Liberal Party and the Nacionalistas exchanging control of the country. Both parties were led by elites and shared similar politics. Early presidents had to contend with the left-wing rural Hukbalahap Rebellion.

The two-party system came to an end under President Ferdinand Marcos, who declared martial law in 1972. Despite strengthening Communist and Islamic separatist rebellions, Marcos retained firm control of the country until economic issues and disenchantment with corruption led to greater opposition. Opponents consolidated around Corazon Aquino, the widow of an assassinated opposition politician. After Marcos was declared winner of a snap election in 1986, military and public protests led to the People Power Revolution which removed Marcos and installed Aquino. A new constitution increased the limits of Presidential power, including creating a single-term limit. Since then, an unstable multi-party system has emerged on the national level, which has been challenged by a series of crises including several attempted coups, a presidential impeachment, and two more public mass movements. This period also saw some political power decentralized to local government and the establishment of the autonomous Bangsamoro region in Muslim Mindanao.

Pre-Spanish era

Before the arrival of Ferdinand Magellan, the Philippines was split into numerous barangays, small states that were linked through region-wide trade networks. The name "barangay" is thought to come from the word balangay, which refers to boats used by the Austronesian people to reach the Philippines. These societies had three classes: the nobility, freemen, and serfs and slaves. They were led by powerful individuals now called datus, although different cultures used different terms. The arrival of Hindu influence increased the power of Indianized datus. The first large state was Sulu, which adopted Islam in the 15th century. This system then spread to the nearby Sultanate of Maguindanao and the Kingdom of Maynila. Ferdinand Magellan's death in 1521 can be partly attributed to a dispute between Lapu-Lapu and Rajah Humabon for control of Cebu. Spanish Captain-General Miguel López de Legazpi established a settlement in Cebu in 1565. Maynila was conquered in 1571, and Manila subsequently became the center of Spanish administration. Spain gradually conquered the majority of the modern Philippines, although full control was never established over some Muslim areas in the south and in the Cordillera highlands.

Spanish era

Colonization and governance Under Spanish rule, barangays were consolidated into urban towns, aiding with control and a shift to a sedentary agricultural society. Nonetheless, the barangay structures were retained (becoming known as barrio), and used as a means to record community identity. Rule during the Spanish era was dominated by the Church, especially friars from Spanish religious orders. Local priests often held powers in towns, carrying out Spanish orders and collecting taxes. In areas where the population had not been consolidated into towns, priests travelled between villages. Ultimate power was held by the King and the Council of the Indies, with the Philippines being part of New Spain. However, due to their distance from both New Spain and Spain itself, the Captaincy General of the Philippines functioned practically autonomously and royal decrees had limited effect. The Philippines had their own Governor, and a judicial body was established in 1583.

Direct Spanish rule did not extend far beyond Manila. Due to the small number of Spanish officials on the islands, which numbered in the tens, locals were relied upon for administration. Existing datus were co-opted to manage barangays and nominate individuals for provincial government. Representatives of the Catholic Church continued to be the most significant direct Spanish presence. Several revolts erupted against Spain, but all were defeated. Some revolts, such as the Tondo Conspiracy, led to greater local participation in the bureaucracy, and the bringing of local elites into a patronage system to prevent further rebellion. The establishment of towns created administrative positions local elites could fill. Traditional native elites, along with some native officeholders and high-value tax payers, became part of a group known as the principalia. This group could make recommendations to the Spanish governor regarding administrative appointments, although they held no direct power. While they were just municipal office-holders, for some their status allowed them to avail of government patronage, and gain special permits and exemptions. Over time, this elite class became more culturally distinct, gaining an education unavailable to most and intermarrying with Spanish officials and Chinese merchants.

Pre-existing trading networks were blocked by Spanish authorities, with all trade instead going to Spanish colonies in the New World. Despite increasing economic activity, the archipelago remained divided by regional identity and language. Some areas remained out of effective Spanish control, including much of Mindanao, the Sulu archipelago, and Palawan. There was conflict between these areas and the Spanish throughout the Spanish period. In the Cordillera highlands, firm Spanish control was limited to the lowland fringes. Inward migration to escape Spanish control and an increase in trade saw settlements in interior areas increase in population and political complexity.

In a process beginning in the late 18th century that would continue for the remainder of Spanish rule, the government tried to shift power from the friars of independent religious orders towards the "secular clergy" of Catholic priests. These priests included local mestizos, and even indios. In the 19th century, Philippine ports opened to world trade and shifts started occurring within Filipino society. In 1808, when Joseph Bonaparte became king of Spain, the liberal constitution of Cadiz was adopted, giving the Philippines representation in the Spanish Cortes. However, once the Spanish overthrew the Bonapartes, the Philippine, and indeed colonial, representation in the Spanish Cortes was rescinded. From 1836, the Philippines were directly governed by the Ministry of Overseas.

Political turmoil in Spain led to 24 governors being appointed to the Philippines from 1800 to 1860, often lacking any experience with the country. Significant political reforms began in the 1860s, with a couple of decades seeing the creation of a cabinet under the Governor-General and the division of executive and judicial power. Societal changes in Spain and the Philippines led to an expansion of the Philippine bureaucracy and its civil service positions, predominantly for the educated living in urban areas, although the highest levels continued to remain in the hand of those born in Spain. This, combined with a shifting economy, saw more complex social structures emerge with new upper and middle classes. A changing economy also brought poverty, which led to raiding and the founding of the Civil Guard. Education reforms in the 1860s expanded access to higher education. The 19th century also saw further attempts to establish control of the mountain tribes of the interior, although success remained limited. Better success occurred in the south, where the Spanish gained control over the seas and coasts, and obtained the surrender of the Sultanate of Sulu in 1878.

National awakening and revolution The Latin American wars of independence and renewed immigration led to shifts in social identity, with the term Filipino shifting from referring to Spaniards born in the Iberian Peninsula and in the Philippines to a term encompassing all people in the archipelago. This identity shift was driven by wealthy families of mixed ancestry, for which it developed into a national identity, and served as a claim to status equal to Spanish peninsulares and insulares. Spanish served as a common language for the growing local elite, who shared a Western educational background despite varied ethnolinguistic origins. Most came from Manila. A class of educated individuals became known as the Ilustrados. This group included individuals who had studied at both local universities and Spanish ones, and came from a variety of socioeconomic backgrounds. They gained prominence in Philippine administration, and became increasingly involved in politics. This added a third group of elites to the two existing groups of the urban bureaucracy and the municipal elites.

Liberal reforms and ideas that had taken root in Spain were resisted by the conservative religious orders that had influence throughout the Philippines. In the 1880s, some prominent Ilustrados, especially those who had studied in Spain, launched the Propaganda Movement. This loose movement sought to reform Spanish administration of the Philippines. The restoration of Philippine representation to the Cortes was one of the grievances raised by the Ilustrados. For the most part it was a campaign for secular self-government as a full part of Spain, as well as equality between those born in Spain and those born in the Philippines. Much of the campaigning took place in Madrid rather than in the Philippines. With liberal reforms rejected, some saw the movement as the beginning of a national awakening, as its members began to return to the Philippines. A small change occurred in 1893, when Spain passed the Maura Law, providing a limited measure of local autonomy.