The end of the colonial era in South America came with the
fall of Spain to Napoleon in 1809. Chile and Buenos Aires, two
of the provinces furthest from the center of Spanish control,
declared themselves independent.
Next, the revolutionaries attacked the stronghold of Spanish colonial power which was in Peru. Under the leadership of the Argentinian Jose San Martin they entered Lima and declared Peru's independence in 1821.
The following year San Martin had a conference in Ecuador with Simon Bolivar, who had driven the Spanish out of the northern part of South America. The meeting was unsuccessful and when San Martin left Peru, Bolivar occupied Lima on Jan 1. 1823.
Simon Bolivar was the greatest military figure of the independence struggle against Spain. He was born in Caracas, Venezuela. As a young man he traveled in Europe, and while in Rome he made a vow to liberate Venezuela.
On his return to Venezuela, Bolivar joined the group of patriots that seized Caracas in 1810 and set up an independent government. But the Spaniards forced him to retreat - first to Colombia, and then to Jamaica and Haiti. In 1816 he returned to Colombia and defeated the Spaniards in a series of battles.
In 1819 Bolivar led the congress that organized the republic of Gran Colombia, which at first included Colombia and Venezuela. Within a few years Panama, Ecuador and Peru joined the republic. Upper Peru became a separate state in 1825, named Bolivia in Bolivar's honor.
Bolivar hoped to form a union of the new South American nations against Spain, but his dream faded in 1830 when the republic of Gran Colombia split into three separate states - Colombia (including Panama), Ecuador, and Venezuela. Bolivar resigend as president of Colombia in the same year.