 In 1814, the naval Battle of Valaparaiso was fought offshore of the town, between American and British ships involved in the War of 1812.After Chile's independence from Spain (1818), beginning the Republican Era, Valparaíso became the main harbour for the nascent Chilean navy, and opened international trade opportunities that had been formerly limited to Spain and its other colonies.Valparaíso soon became a desired stopover for ships rounding South America via the Straits of Magellan and Cape Horn.