In 1862 a Spanish squadron set sail from Cadiz. Through their journey they stopped in several countries of South America, most of which had gained their independence in the previous 50 years: Brazil, Argentina, Chile and at last Peru and after made for San Francisco and Acapulco, however in Panama the admiral Pinzon Alvarez, who was in charge, received the news about an incident in Peru.
In 1859 a group of Spanish settlers arrived, authorized by the government in Peru and destined to work in Talambo Estate. But problems began as soon as the first group arrived, as they deserted the project taking the money they had been given in advance. They took up vegetable and cotton farming, which produced a bit of a conflict, since it was what the owner of Talambo had brought them to work in his estate in the first place.
In August,1863 one of the Spanish settlers and the Talambo owner met each other by coincidence. There were words and threats, but it didn't go further than that. However the estate owner, deeply offended, sent his butler to apprehend the settler. A shooting followed, leaving one Spaniard and one Peruvian dead, and several wounded.
So, when Admiral Pinzon heard the Talambo affair in Callao, several of the high officers in the fleet complained about their fallen countryman to the Peruvian authorities. The news reached Madrid in September, though the information was rather confusing and there was even talk of horrific murders, there was an intensive Spanish thirst for justice, or vengeance, depending on the point of view. October though, the information was correct.
When the competent Spanish Deputy in Peru, Eusebio Salazar y Mazarredo requested an audience with the Peruvian government, he was told that he would be granted only a confidential audience, as they didn't recognize his position of Deputy. Salazar left incensed and met Admiral Pinzon, telling him that the Peru would not resolve the case justly and also that the country was taking up arms
Salazar's principal orders were to keep the peace and act as informant of the Spanish government, he gave Admiral Pinzon his secondary orders in which peace was only incidental to the resolution of the Talambo case and that the use of force was justified if they perceived a threat to their ships or their national honour. Admiral Pinzon asked for the rest of the orders, but Salazar told him they weren't important. The result: in April 1864, the squadron occupied the Chinchas Islands.
When the news reached Spain, Salazar was disavowed, since the Spanish immersion in this conflict was his responsibility, but decided to send reinforcement at a very likely Peruvian attack. Four more ships set sailed to Peru and it was agreed that they would later send the ironclad, Numancia.
The Spanish and Peruvian government began negotiations as the President of Peru, Juan Antonio Perez was reluctant to attack mainly because they would never be able to beat the Spanish squadron with the forces they had. Both countries signed the Treaty of Vivanco-Pareja in 1865. Perhaps it could have ended there - in that case, there wouldn't have been a war
Marshal Ramon Castilla, president of the Senate, protested angrily and directly. He got into a heated discussion with President Pezet who had gone to the senate to explain the situation. Castilla even went as far as punching the president (he was exiled for this!). But then soldiers and civilians formed an uprising. But then several militaries and civilians uprised. Colonel Mariano Ignacio Prado arrived in Lima with an army of 10,000. Pezet had some 8,000 soldiers...but it didn't get to the point of confrontation until they reached Lima's main square. The troops loyal to President Pezet didn't surrender until three quarters were down.
After this Pezet thought about taking the Palace of Government back, but there was a lot of desertion among his troops and he didn't quite find the courage to attack Lima. In the end he embarked on a ship to England.
It may sound odd that Chile's public opinion got so exalted when the incidents had happened in Peru, an entirely different country. But, significantly, the whole continent was revolutionized not so long ago when they fought for their independence, in many cases together, therefore it's understandable that on the one hand there was certainly an anti-Spanish sentiment and solidarity among the new Republics.
Hostile incidents arose and the Chilean government decided to deny any logistical support to the Spanish naval units in Chilean ports. Spanish Admiral José Manuel Pareja was appointed as Plenipotentiary Minister in Chile and he pressed the government to lift all restrictive measures of his squadron.
Pareja gave Chile an ultimatum: if in four days the situation didn't improve, hostilities would begin. So when Chile refused to comply, Pareja proceeded to block the Chilean coast, which is a little ridiculous since he didn't exactly have a largest of fleets and Chile has over 2,700 miles of coast, so he blockaded Coquimbo and Caldera. In response, Chile declared war on Spain on September 25, 1865.
In the meanwhile Colonel Prado became the new president of Peru, though with the title of Supreme Head of the Nation (dictator). On December 1865, he announced a rupture of relations with Spain, which meant an official declaration of war. Eventually Ecuador and Bolivia would follow.
The first military action ended with a Spanish schooner, the Covadonga captured by the Chilean squadron. Admiral Pareja had authorized the Chilean corvette La Esmeralda (he had no idea that it was meant to attack them) and had sent the small Covadonga to the conflict. He felt so guilty that he killed himself. He was succeeded by Casto Méndez Núñez, who tried to recover the Covadonga.
In January 1866 Offensive and Defensive Alliance, between the Republics of Peru and Chile was signed. It invited other republics to confront the Spanish squadron. Ecuador and Bolivia joined, but they didn't participate, however Ecuador fortified its main port, Guayaquil, in case of a Spanish offensive.
So, Méndez Núñez gave an ultimatum, he wanted his ship Covadonga back, otherwise he would bomb the port of Valparaiso. Chile said it would not give it back. Then the UK and the US said that they would intervene if they bombing took place, to which Spain said they would be considered enemies if they got in the middle.
On the March 31st Spain fulfilled its promise and bombs fell on Valparaiso. There were two casualties and some 10 wounded, as the citizens had been warned beforehand and most of them had evacuated the city, but the port was badly damaged.
Méndez Nuñez and is officials knew perfectly well that they would be greatly criticized for this since it was a defenseless port (the cannons had been taken out by the Chilean, so the world would know Valparaiso had been undefended) and expressed their discomfort to the authorities in Madrid. He was right, the world was scandalized and the squadron's action frowned upon. So he set sail for the Peruvian Port Callao, one of the best defended in the south of the Pacific.
After Valparaiso On May 2 the Spanish squadron proceeded to bomb the port of Callao. There were a few cannon shots back and forth. Méndez Núñez received 8 wounds from one of them. He refused to leave his position until the loss of blood made him faint. At 6 in the afternoon the last shots were fired. On the Spanish side there were 43 casualties and over 80 wounded. The number of casualties on the Peruvian side are uncertain, some say 200, others say 2000.
After a few more skirmishes the Spanish course of action was to retreat and left the South American coast. The results of the war differ according to which side is telling the story. According to the Spanish, they had won, as it was a punishment operation, not an invasion. Chile and Peru believed they had won as the Spanish squadron left
Spain signed peace treaties with all the South American countries that had declared war. First with Peru in 1871, in 1879 with Bolivia. Definite peace with Chile was signed in 1883 while Chile occupied Lima during the War of the Pacific, and with Ecuador in 1885.
Peru considers that the war with Spain consolidated their independence. In this country the war left some serious economic consequences. After the war Chile began a rearmament campaign, which meant they were military greatly superior to its neighbours. But it also had dire economic consequences for this country, since it lost most of its fleet and therefore the trade hegemony over the Pacific.
Despite the Spanish school of thought that claims Spain's victory, the war gave little overall benefit to the country. Aside from they great expenses in which it incurred with the expedition and subsequent war, the Iberian country was also hit by a European economic crisis. So, pretty much an all round useless war.