El Salvador is a country in Central America. It is bordered on the northeast by Honduras, on the northwest by Guatemala, and on the south by the Pacific Ocean. El Salvador's capital and largest city is San Salvador. As of 2018, the country had a population of approximately 6.42 million, making it the smallest and second-least populated country in Central America. For millennia, the region was controlled by several Mesoamerican nations, especially Lenca, Mayans, then later the Cuzcatlecs. Archaeological monuments also suggest an early Olmec presence around the first millennium BC. In the beginning of the 16th century, the Spanish Empire conquered the Central American territory, incorporating it into the Viceroyalty of New Spain ruled from Mexico City. However the Viceroyalty of Mexico had little to no influence in the daily affairs of the isthmus, which was colonized in 1524. In 1609, the area was declared the Captaincy General of Guatemala by the Spanish, which included the territory that would become El Salvador until its independence from Spain in 1821. It was forcefully incorporated into the First Mexican Empire, then later seceded, joining the Federal Republic of Central America in 1823. When the republic dissolved in 1841, El Salvador became a sovereign nation, then formed a short-lived union with Honduras and Nicaragua called the Greater Republic of Central America, which lasted from 1895 to 1898.
From the late 19th to the mid-20th century, El Salvador endured chronic political and economic instability characterized by coups, revolts, and a succession of authoritarian rulers. Persistent socioeconomic inequality and civil unrest culminated in the devastating Salvadoran Civil War from 1979 to 1992, fought between the military-led government and a coalition of left-wing guerrilla groups. The conflict ended with the Chapultepec Peace Accords. This negotiated settlement established a multiparty constitutional republic, which remains in place to this day.
While this Civil War was going on in the country large numbers of Salvadorans immigrated to the United States, resulting in an immigrant population comparable to that of China's. Although China's territory is 500 times larger and the population is 200 times larger, by 2008 there were nearly as many Salvadoran immigrants to the United States as Chinese immigrants to the United States. El Salvador's economy has historically been dominated by agriculture, beginning with the Spanish taking control of the indigenous cacao crop in the 16th century, with production centered in Izalco, and the use of balsam from the ranges of La Libertad and Ahuachapan. This was followed by a boom in use of the indigo plant in the 19th century, mainly for its use as a dye. Thereafter the focus shifted to coffee, which by the early 20th century accounted for 90% of export earnings. El Salvador has since reduced its dependence on coffee and embarked on diversifying its economy by opening up trade and financial links and expanding the manufacturing sector. The colón, the currency of El Salvador since 1892, was replaced by the United States dollar in 2001. El Salvador ranks 14th among Latin American countries in terms of the Human Development Index and third in Central America (behind Panama and Costa Rica) partly because of ongoing rapid industrialization. However, the country continues to struggle with high rates of poverty, inequality, and gang-related violent crime.