The history of the Philippines is believed to have begun with the arrival of the first humans via land bridges at least 30,000 years ago. The first recorded visit from the West is the arrival of Ferdinand Magellan, who sighted Samar on March 16, 1521 and landed on Homonhon Island southeast of Samar the next day.
Before Magellan arrived, Negrito tribes roamed the isles, but they were later supplanted by Austronesians. These groups then stratified into: hunter-gatherer tribes, warrior-societies, petty plutocracies and maritime oriented harbor principalities which eventually grew into kingdoms, rajahnates, principalities, confederations and sultanates. States such as the Indianized Rajahnate of Butuan and Cebu, the dynasty of Tondo, the august kingdoms of Maysapan and Maynila, the Confederation of Madyaas, the sinified Country of Mai, as well as the Muslim Sultanates of Sulu and Maguindanao. These small states flourished from as early as the 10th century AD, Despite these kingdoms attaining complex political and social orders, as well as enjoying trade with areas now called China, India, Japan, Thailand, Vietnam, and Indonesia, none encompassed the whole archipelago which was to become the unified Philippines of the twentieth century. The remainder of the settlements were independent Barangays allied with one of the larger nations.
Spanish colonization and settlement began with the arrival of Miguel López de Legazpi's expedition on February 13, 1565 who established the first permanent settlement of San Miguel on the island of Cebu. The expedition continued northward reaching the bay of Manila on the island of Luzon on June 24, 1571, where they established a new town and thus began an era of Spanish colonization that lasted for more than three centuries.
Spanish rule achieved the political unification of almost the whole archipelago, that previously had been composed by independent kingdoms and communities, pushing back south the advancing Islamic forces and creating the first draft of the nation that was to be known as the Philippines. Spain also introduced Christianity, the code of law, the oldest Universities and the first public education system in Asia, the western European version of printing, the Gregorian calendar and invested heavily on all kinds of modern infrastructures, such as train networks and modern bridges.
The Spanish East Indies were ruled as a territory of the Viceroyalty of New Spain and administered from Mexico City, Mexico from 1565 to 1821, and administered directly from Madrid, Spain from 1821 until the end of the Spanish–American War in 1898, except for the brief British occupation of the Philippines from 1762 to 1764. During the Spanish period, numerous towns were founded, infrastructures built, new crops and livestock introduced. The Chinese, British, Portuguese, Dutch, Japanese, and indigenous traders, complained that the Spanish reduced trade by attempting to enforce a Spanish monopoly. Spanish missionaries attempted to convert the population to Christianity and were eventually generally successful in the northern and central lowlands. They founded schools, a university, and some hospitals, principally in Manila and the largest Spanish fort settlements. Universal education was made free for all Filipino subjects in 1863 and remained so until the end of the Spanish colonial era. This measure was at the vanguard of contemporary Asian countries, and led to an important class of educated natives, like Jose Rizal. Ironically, it was during the initial years of American occupation in the early 20th century, that Spanish literature and press flourished.
The Philippine Revolution against Spain began in August 1896, but it was largely unsuccessful until it received support from the United States, culminating two years later with a proclamation of independence and the establishment of the First Philippine Republic. However, the Treaty of Paris, at the end...