The territory that became Colombia was first visited by Europeans when the first expedition of Alonso de Ojeda arrived at the Cabo de la Vela in 1499. The Spanish made several attempts to settle along the north coast of today's Colombia in the early 16th century, but their first permanent settlement, at Santa Marta, was not established until 1525. Cartagena was founded on June 1, 1533 by Spanish commander Pedro de Heredia, and grew rapidly, fueled first by the gold in the tombs of the Sinú culture, and later by trade. The Spanish advance from inland from the Caribbean coast began independently from three different directions, under Jimenéz de Quesáda, Sebastián de Belalcázar and Nikolaus Federmann. Although all three were drawn by the Indian treasures, none intended to reach Muisca territory, where they finally met. In August 1538 Quesáda founded Santa Fe de Bogotá on the site of Muisca village of Bacatá. In 1549, the Spanish Royal Audiencia made Bogotá the capital of New Granada, which comprised in large part what is now territory of Colombia. In 1717, the Viceroyalty of New Granada was originally created, with Santa Fé de Bogotá as its capital. This Viceroyalty included some other provinces of northwestern South America which had previously been under the jurisdiction of the Viceroyalties of New Spain or Peru and correspond mainly to today's Venezuela, Ecuador and Panama. Bogotá thus became one of the principal administrative centers of the Spanish possessions in the New World.
Independence
A movement initiated by Antonio Nariño, who opposed Spain's centralism and led the opposition against the viceroyalty, leading to the independence of Cartagena in November 1811, and the formation of two independent governments which fought a civil war – a period known as La Patria Boba. The following year Nariño proclaimed the United Provinces of New Granada, headed by Camilo Torres Tenorio. Despite the successes of the rebellion, the emergence of two distinct ideological currents among the liberators gave rise to an internal clash which contributed to the reconquest of territory by the Spanish. The viceroyalty was restored under the command of Juan de Samano, whose regime punished those who participated in the uprisings. Renewed rebellion, combined with a weakened Spain, made possible a successful rebellion led by the Venezuelan-born Simón Bolívar, who finally proclaimed independence in 1819. The pro-Spanish resistance was finally defeated in 1822 in the present territory of Colombia and in 1823 in Venezuela. The territory of the Viceroyalty of New Granada became the Republic of Colombia organized as a union of Ecuador, Colombia and Venezuela. The Congress of Cúcuta in 1821 adopted a constitution for the new Republic, and Simón Bolívar became the first President of Colombia. However, the new republic was unstable and ended with the rupture of Venezuela in 1829 and Ecuador in 1830.
Post-independence
Colombia and Spain officially established diplomatic relations in 1881 when representatives of both nations signed a Treaty of Peace and Friendship in Paris. During the years, relations between the two nations decreased as Spain lost its importance in the region, especially after its defeat in the Spanish–American War and Spain's influence in the region diminished. During the Spanish Civil War, many in Colombia supported the Nationalist faction led by General Francisco Franco against the Republican faction. During this time, some Spaniards immigrated to Colombia to flee the war. However, they were not large in number relative to the Spanish immigration to Argentina, Mexico and Uruguay during the same period. After the war, Colombia maintained diplomatic relations with the Spanish government under General Franco. In October 1976, Spanish King Juan Carlos I paid an official visit to Colombia, his first as King of Spain. Since then, the Spanish royal family has paid several visits to Colombia and several Colombian presidents have paid official visits to Spain. Over the years, both nations have signed agreements and treaties on judicial cooperation, dual nationality, extradition, social security, guarantee of intellectual property, promotion and protection of investments, tourisim, avoidance of double taxation and agreement for resident citizens of both nations to vote in local municipal elections.
In 2016, total trade between Colombia and Spain totaled €1.6 billion Euros. Colombia's main exports to Spain include: fish, fruits and vegetables, coffee, sugar, cacao, oil, iron and minerals. Spain's main exports to Colombia include: machinery, electrical equipment, pharmaceutical products and organic chemicals. Spanish multinational companies such as Banco Bilbao Vizcaya Argentaria, Banco Santander, Mapfre, Telefónica and Zara operate in Colombia. In 2011, Colombia signed a free trade agreement with the European Union.