Ecuadorian War of Independence The Ecuadorian War of Independence was fought from 1820 to 1822 between several South American armies and Spain over control of the lands of the Royal Audience of Quito , a Spanish colonial administrative jurisdiction from which would eventually emerge the modern Republic of Ecuador . The war ended with the defeat of the Spanish forces at the Battle of Pichincha on May 24 , 1822 , which brought about the independence of the entire " . The Ecuadorian War of Independence is part of the Spanish American wars of independence fought during the first two decades of the 19th century . Beginning of the war . The military campaign for the independence of the territory now known as Ecuador from Spanish rule could be said to have begun after nearly three hundred years of Spanish colonization . Quito was a city of around ten thousand inhabitants . It was there , on August 10 , 1809 that the first call for independence from Spain was made in Latin America ( " " " ) , under the leadership of the city ' s criollos , including Carlos Montúfar , Eugenio Espejo and Bishop Cuero y Caicedo . Then on October 9 , 1820 , the port - city of Guayaquil proclaimed its independence after a brief and almost bloodless revolt against the local garrison . The leaders of the movement , a combination of Venezuelan , Ecuadorian , and Peruvian pro - independence officers from the colonial Army , along with Ecuadorian intellectuals and patriots , set up a " Junta de Gobierno " and raised a military force with the purpose of defending the city and carrying the independence movement to the other provinces in the country . By that time , the tide of the wars of independence in South America had turned decisively against Spain : Simón Bolívar ' s victory at the Battle of Boyacá ( August 7 , 1819 ) had sealed the independence of the former Viceroyalty of Nueva Granada , while to the south , José de San Martín , after landing his Army on the Peruvian coast on September 8 , 1820 , was preparing the campaign for the independence of the Viceroyalty of Perú . The news of the proclamation of independence of Guayaquil spread rapidly to other cities in the " Presidencia " , and several towns followed the example in quick succession . Portoviejo declared its independence on October 18 , 1820 , and Cuenca — the economic center of the southern highlands — did the same on November 3 , 1820 . The stage was set for the campaign of liberation of Quito . The " moves to the offensive . The military unit raised and financed in Guayaquil was given the name of " ( " Division for the Protection of Quito " ) . Its immediate purpose was to advance on the cities of Guaranda and Ambato , in the central highlands , hoping to bring these cities to the independentist cause , and cutting all road communications between Quito and the cities of Guayaquil and Cuenca , so as to forestall any Royalist countermove from the north . The Division , under the command of Colonel Luis Urdaneta , one of the ringleaders of the revolt in Guayaquil , began its advance out of the coastal plain towards the highlands , and by November 7 , was ready to begin its march up the Andes mountains . The first clash with a Royalist covering force was a success , occurring on November 9 , 1820 , at Camino Real , a strategic mountain pass along the road from Guayaquil to Guaranda . This victory opened the way into the inter - Andean highlands , and the capture of Guaranda soon followed . News of the presence of the patriot army in Guaranda had the intended effect : most of the towns in the highlands went on to proclaim their independence in quick succession , Latacunga and Riobamba doing it on November 11 , and Ambato on November 12 , 1820 . By the middle of November , the Spanish rule over the " Presidencia " had been reduced to the Quito and its surrounding areas in the northern highlands . It looked as if the liberation of the entire territory would be easier than expected . But the hopes turned out to be premature and short - lived . Field - Marshal Melchor Aymerich , acting President and supreme commander of the military forces in the Presidencia de Quito , took swift action . Soon , an army of around 5 , 000 troops , under the command of veteran Spanish Colonel Francisco González , was dispatched south to deal with the 2 , 000 - strong patriot army , stationed in Ambato . In the Battle of Huachi , on November 22 , 1820 , the Royalist army inflicted a severe defeat on Urdaneta ' s force , which had to fall back , badly mauled , to Babahoyo , on the coastal plains . Disaster struck the patriots . The Spanish army continued its advance south , towards Cuenca , retaking all major towns along the way . On December 20 , 1820 , after the defenders of the city were defeated at the Battle of Verdeloma , Cuenca was retaken by the Royalist army . The authorities in Guayaquil , who on November 11 , 1820 , had issued a decree creating the ' ( Free Province of Guayaquil ) , desperately organized a ragtag detachment with the survivors of Huachi plus some reinforcements ( 300 men altogether , including some 50 cavalry ) , ordering it to make a final stand at Babahoyo . As the Royalist army did not seem to be particularly inclined to come down to the plains to meet them , the patriots sent some guerrilla bands back into the highlands , which were finally ambushed and massacred on January 4 , 1821 at the Battle of Tanizagua . The guerrillas ' commanding officer , Spanish - born Colonel Gabriel García Gomez , taken prisoner after the battle , was executed by a firing squad and decapitated , his head sent to Quito to be displayed before the population . Thus , amid total military failure and a number of Royalist reprisals on the civilian population of the highlands cities , the attempt of the ' to carry out the independence of the " came to an end . Sucre enters the scene . And yet , not all was lost : help was on the way . By February 1821 , the foreign aid requested by the " back in October finally materialized in the form of Spanish - born independentist General José Mires , sent by General Simón Bolívar , President of Colombia . Even more welcomed perhaps was what Mires had brought along with him : 1 , 000 muskets ; 50 , 000 musket rounds ; 8 , 000 bits of flint ; 500 sabers , and 100 pairs of pistols . Mires ' instructions were clear : " To liberate the capital city of Quito , whose taking will bring about the liberation of the whole Department " , as the first step towards later operations aimed at securing the complete independence of Perú . Bolívar also informed Guayaquil that he would begin a simultaneous campaign from the north . Second Battle of Huachi . By July 1821 , Sucre had almost finished deploying the Army around Babahoyo , ready to advance on the highlands as soon as the weather allowed . Aymerich acted to preemt the patriot plans with a two - pincer movement : he would lead his Army from Guaranda down to Babahoyo , while Colonel González , coming from the southern highlands down to Yaguachi , would attack his flank . Sucre , privy to Aymerich ' s intentions ( thanks to a well - developed espionage network ) , sent Mires to deal with González . The encounter , which ended up destroying Gonzalez ' s force , took place near the town of Cone , on August 19 , 1821 . Upon hearing the news , Aymerich retraced his steps and headed back to the highlands . Sucre advanced on to the highlands , his main force occupying Guaranda on September 2 , 1821 . Aymerich moved to block any further progress , and in the Second Battle of Huachi , which took place on September 12 , 1821 , annihilated Sucre ' s infantry . The patriot forces lost 800 men , mostly killed , plus 50 prisoners , among them General Mires . As Second Huachi had also taken a heavy toll on the Royalists , Aymerich decided against exploiting his victory with an advance on the coastal plains . On November 19 , 1821 , a 90 - day armistice was signed at Babahoyo , putting an end to Sucre ' s ill - fated first attempt to liberate Quito .