There were about 25,000 Amerindians in the region when Columbus landed in 1502. He named the area Costa Rica ("rich coast"), probably because he saw gold ornaments on some of the Indians. Costa Rica was organized as a province by the Spanish in 1540 and was eventually placed under the provincial administration in Guatemala. Cartago, the colonial capital, was founded in 1563.
When independence came to Central America in 1821, Costa Rica had fewer than 70,000 inhabitants. In the following year, it was absorbed into the short-lived Mexican Empire proclaimed by Agustín de Iturbide. Following the collapse of Iturbide's rule, Costa Rica became a member of the United Provinces of Central America in 1823. At the same time, the provincial capital of Costa Rica became San José. The United Provinces fell apart in 1838, and in 1848, the Republic of Costa Rica was established. The new state was threatened by William Walker, a US military adventurer who invaded Central America in 1855, but his troops were repelled in 1857, and in 1860 Walker was captured and executed. In 1871, General Tomás Guardia, a dictator, introduced the constitution that, though frequently modified, remained Costa Rica's basic law until 1949.
In the late 19th and early 20th centuries, there was a series of boundary disputes with Panama and Nicaragua, in the course of which Costa Rica annexed Guanacaste Province from Nicaragua. In World Wars I and II, Costa Rica was a US ally, but not a military participant.
Meanwhile, the success of coffee cultivation, introduced in the early 1800s, had encouraged rapid population growth, progress in education, and the beginnings of modern economic development, through the construction of a coast-to-coast railroad from Limón on the Caribbean through San José to the Pacific. Banana cultivation was started in 1871, and the United Fruit Co. (now United Brands) made Costa Rica a major producer of bananas.
A period of relative political stability that began with the turn of the century ended after World War II, when President Teodoro Picado Michalski annulled the 1948 elections in order to impose Rafael Ángel Calderón Guardia as president rather than the legally elected Otilio Ulate Blanco. José Figueres Ferrer led a civilian uprising, installed his own junta for 18 months, and restored democratic government, turning over the presidency to Ulate. In 1949, a new constitution, based on the constitution of 1871, reinstated free elections and banned a standing army.
Figueres was elected president by an overwhelming majority in 1952 (with women voting for the first time), and under his leadership, Costa Rica was one of the most democratic and prosperous countries in Latin America. Figueres was strongly opposed to all dictatorships, and Costa Rica proceeded to sever diplomatic relations with several Latin American countries. Border skirmishes with Nicaragua in 1955 were resolved through OAS mediation.
In 1958, the candidate of the opposition National Unification Party, Mario Echandi Jiménez, was elected by a bare majority vote. He was unable to enact his program of minimizing the government's role in social and economic matters because the legislature was dominated by other parties. In 1962, Francisco J. Orlich Bolmarich, a candidate of Figueres's National Liberation Party (Partido de Liberación Nacional—PLN), won the elections and continued Figueres's progressive program. Costa Rica joined the Central American Common Market (CACM) in 1963 and has benefited from Central American economic integration, especially through increasing industrialization. Figueres served as president again from 1970 to 1974 and was succeeded by the PLN candidate, Daniel Oduber Quirós. A conservative, Rodrigo Carazo Odio, was elected president in 1978, and Luis Alberto Monge Álvarez of the PLN became president in 1982.
During the 1980s, Costa Ricans were confronted with a severe economic crisis and with increasing political violence in the region, including sporadic terrorist activities in San José. The Monge government introduced an austerity program to help economic recovery and also tried to avoid being drawn into the war in neighboring Nicaragua between the insurgents known as "contras" and the Sandinista government. Nevertheless, the government resisted pressure from the United States to support the contras or to accept US aid toward the building of a military establishment.
In February 1986, the PLN won the presidential election, with Oscar Arias Sánchez defeating Rafael Ángel Calderón Fournier. An important factor in the PLN victory was the popularity of the incumbent, President Monge. In August 1987, a peace plan for Central America outlined by Arias was signed in Guatemala by Nicaragua, Guatemala, Costa Rica, El Salvador, and Honduras. Among the provisions were free elections in all countries, a guarantee of basic democratic freedoms in Nicaragua, a cease-fire by both Sandinistas and contras, an end to outside aid to the contras, amnesty for the contras, repatriation or resettlement of refugees from all countries, and an eventual reduction in the armed forces of all countries. Arias won the Nobel Prize for peace later in that year.
In 1990, amid continued economic troubles, Calderón Fournier was elected, and his Social Christian Unity Party (PUSC) won a paper-thin majority in the Legislative Assembly. Although he campaigned on a platform of liberalization and the reduction of Costa Rica's social welfare system, little change was accomplished. The economy nevertheless rebounded, with peace settlements easing some of Costa Rica's demographic problems.
On 6 February 1994, Costa Ricans returned the PLN to power, as José María Figueres Olsen, son of former president Figueres, was elected president of Costa Rica. In response to the nation's weakening economy, Figueres introduced an economic reform package in 1995 that focused on government-spending cuts and the privatization of state-owned enterprises. These measures, which represented a reversal of the traditional policies of Figueres's PLN ruling party, drew stiff opposition from labor leaders, who feared cutbacks in Costa Rica's large public sector, and touched off a month-long strike by the nation's teachers. Although the government responded by modifying some of its proposed plans, public support for Figueres plummeted as the nation's economy continued to slip, officially entering a recession in 1996. In December 1996 Figueres announced plans to raise taxes, privatize parts of the state-owned banking and telecommunications systems, and end the state insurance monopoly.
Elections were held again in February of 1998 and Social Christian (PUSC) leader Miguel Angel Rodríguez won with 46.9% of the vote, narrowly defeating National Liberation Party candidate José Miguel Corrales who obtained 44%. Rodríguez's party also won 29 of out 49 seats in the unicameral Congress. The sweeping Social Christian Union Party victory was attributed to popular discontent with Figueres' National Liberation Government between 1994 and 1998. Rodríguez was a popular president and his government had some important achievements. That helped PUSC candidate Abel Pacheco win the 2002 presidential election with 58% of the vote. Yet, Pacheco was the first president since 1948 to have needed a runoff election to win the presidency. A field of three presidential candidates prevented him from securing a victory in the first round vote held on February 2002. Pacheco has continued with the policies of economic liberalization and human capital investment championed by his predecessors.