For the most part, it was an indirect influence created from the aftermath of the French Revolution.
The French Revolution led to the rise of Napoleon and the Napoleonic Wars, during which Spain was overrun and reduced to a second-rate power. Although Spanish power and influence had been waning for more than two centuries already, it still had considerable military strength at the time of the French Revolution in 1789.
Most of the revolutions in Latin America occurred during the peak years of the Napoleonic Wars, when Spain itself was embroiled in a civil war between the supporters of the rightful Bourbon King and supporters of Joseph Bonaparte, the brother of Napoleon whom he foisted on the throne. The country itself was a battleground for many years, and was devastated.
Under these circumstances, there was no way that Spain could contain the nascent independence movements in its vast colonial holdings. Even after Napoleon was defeated, Spain lacked the resources to restore its rule over those lands. In the early 1820s, the restored Bourbons of France and Spain were conspiring to restore colonial rule to the former Spanish colonial empire. In response, the United States issued the Monroe Doctrine in 1823, and the British pledged their support to this ideaâboth countries like the idea of being able to trade freely and openly with the newly independent nations of Latin America. So the Bourbons had to bag the idea.
Insofar as how all of this was a domino effect, you can really trace it all the way back to the American Revolution. This was the event that inspired both the French Revolution (which bankrupted the Old Regime and also inspired the sans-culottes to overthrow it), and also helped inspire the people of the Spanish empire. After all, if those British colonies could do it, why couldnât the Spanish colonies, which were under the thumb of a much weaker mother country?