War of the Pacific: Two Chilean ships blocking the harbor of Iquique (then belonging to Peru) battle two Peruvian vessels in the Battle of Iquique.

The Battle of Iquique was a naval engagement that occurred between a Chilean corvette under the command of Arturo Prat Chacn and a Peruvian ironclad under Miguel Grau Seminario on 21 May 1879, during the naval stage of the War of the Pacific, that pitted Chile against Peru and Bolivia. The battle took place off the then-Peruvian port of Iquique. The ironclad Huscar sank the Chilean wooden corvette Esmeralda, after four hours of combat, resulting in a Peruvian victory.

The War of the Pacific (Spanish: Guerra del Pacífico), also known as the Saltpeter War (Spanish: Guerra del salitre) and by multiple other names, was a war between Chile and a Bolivian–Peruvian alliance from 1879 to 1884. Fought over Chilean claims on coastal Bolivian territory in the Atacama Desert, the war ended with a Chilean victory, which gained for the country a significant amount of resource-rich territory from Peru and Bolivia.

The war began over a nitrate taxation dispute between Bolivia and Chile, with Peru being drawn in due to its secret alliance with Bolivia. But historians have pointed to deeper origins of the war, such as the interest of Chile and Peru in the nitrate business, the long-standing rivalry between Chile and Peru, as well as political and economical disparities between Chile and Peru and Bolivia. On February 14, 1879, Chile's armed forces occupied the Bolivian port city of Antofagasta, subsequently war between Bolivia and Chile was declared on March 1, 1879, and between Chile and Peru on April 5, 1879.

Battles were fought in the Pacific Ocean, the Atacama Desert, the Peruvian deserts, and the mountainous interior of Peru. For the first five months, the war played out in a naval campaign, as Chile struggled to establish a marine resupply corridor for its forces in the world's driest desert. Afterwards, Chile's land campaign bested the Bolivian and Peruvian armies. Bolivia withdrew after the Battle of Tacna, on May 26, 1880. Chilean forces occupied Peru's capital Lima in January 1881. Remnants and irregulars of the Peruvian army waged a guerrilla war but could not prevent war-weary Peruvian factions from reaching a peace deal with Chile involving territorial cessions.

Chile and Peru signed the Treaty of Ancón on October 20, 1883. Bolivia signed a truce with Chile in 1884. Chile acquired the Peruvian territory of Tarapacá, the disputed Bolivian department of Litoral (turning Bolivia into a landlocked country), and the temporary control over the Peruvian provinces of Tacna and Arica. In 1904, Chile and Bolivia signed the Treaty of Peace and Friendship, which established definite boundaries. The 1929 Tacna–Arica compromise gave Arica to Chile and Tacna to Peru.