Although they were not the first Europeans in the Philippines, the first well documented arrival of western Europeansin the archipelago was the Spanish expedition led by Portuguese Ferdinand Magellan, which first sighted the mountains of Samar at dawn on 16 March 1521 (Spanish calendar), making landfall the following day at the small, uninhabited island of Homonhon at the mouth of the Leyte Gulf. Magellan had abandoned his Portuguese citizenship and became a Spanish subject prior to his contract with Spain. On Easter Sunday, 31 March 1521 (Spanish calendar), at Masao, Butuan, (now in Agusan Del Norte), he solemnly planted a cross on the summit of a hill overlooking the sea and claimed possession of the islands he had seen for Spain, naming them Archipelago of Saint Lazarus.
Magellan sought friendship among the natives beginning with Datu Zula, the chieftain of Sugbu (now Cebu), and took special pride in converting them to Catholicism. Magellan got involved with political rivalries among the Cebuano natives and took part in a battle against Lapu-Lapu, chieftain of Mactan island and a mortal enemy of Datu Zula. At dawn on 27 April 1521, Magellan invaded Mactan Island with 60 armed men and 1,000 Cebuano warriors, but had great difficulty landing his men on the rocky shore. Lapu-Lapu had an army of 1,500 on land. Magellan waded ashore with his soldiers and attacked the Mactan defenders, ordering Datu Zula and his warriors to remain aboard the ships and watch. Magellan seriously underestimated the Lapu-Lapu and his men, and grossly outnumbered, Magellan and 14 of his soldiers were killed. The rest managed to reboard the ships. (See Battle of Mactan)
The battle left the Spanish too few to man three ships so they abandoned the "Concepción". The remaining ships - "Trinidad" and "Victoria" - sailed to theSpice Islands in present-day Indonesia. From there, the expedition split into two groups. The Trinidad, commanded by Gonzalo Gómez de Espinoza tried to sail eastward across the Pacific Ocean to the Isthmus of Panama. Disease and shipwreck disrupted Espinoza's voyage and most of the crew died. Survivors of the Trinidad returned to the Spice Islands, where the Portuguese imprisoned them. The Victoria continued sailing westward, commanded by Juan Sebastián de El Cano, and managed to return to Sanlúcar de Barrameda, Spain in 1522. In 1529, Charles I of Spain relinquished all claims to the Spice Islands to Portugal in the treaty of Zaragoza. However, the treaty did not stop the colonization of the Philippine archipelago from New Spain.
After Magellan's voyage, subsequent expeditions were dispatched to the islands. Four expeditions were sent: that of Loaisa (1525), Cabot (1526), Saavedra (1527), Villalobos (1542), and Legazpi(1564).The Legazpi expedition was the most successful as it resulted in the discovery of the tornaviaje or return trip to Mexico across the Pacific by Andres de Urdaneta. This discovery started the trade of the famous Manila Galleons which lasted two and a half centuries.
In 1543, Ruy López de Villalobos named the islands of Leyte and Samar Las Islas Filipinas after Philip II of Spain. Philip II became King of Spain on January 16, 1556, when his father, Charles I of Spain, abdicated the Spanish throne. Philip was in Brussels at the time and his return to Spain was delayed until 1559 because of European politics and wars in northern Europe. Shortly after his return to Spain, Philip ordered an expedition mounted to the Spice Islands, stating that its purpose was "to discover the islands to the west". In reality its task was to conquer the Philippines for Spain.
On April 27, 1565, a Spanish expedition of a mere 500 men led by Miguel Lopez de Legazpi landed in Bohol and made a blood compact with Raja Katuna and Raja Gala. He and his men then proceeded to the nearby island of Cebu, where they were attacked by the defiant Tupas, who had succeeded Humabon as king of Cebu. Tupas was defeated and requested to sign an agreement which placed his people and the entire island of Cebu under Spain. On that same day, the first permanent Spanish settlement of San Miguel was founded in Cebu. In 1570, Juan de Salcedo, in the service of Legazpi, conquered the Kingdom of Maynila (now Manila). Legazpi then made Maynila the capital of the Philippines and simplified its spelling to Manila. His expedition also renamed Luzon Nueva Castilla. Legazpi became the country's first governor-general. With time, Cebu's importance fell as power shifted north to Luzon. The archipelago was Spain's outpost in the orient and Manila became the capital of the entire Spanish East Indies. The colony was administered through the Viceroyalty of New Spain (now Mexico) until 1821 when Mexico achieved independence from Spain. After 1821, the colony was governed directly from Spain.