During Spanish colonial times, the Spanish controlled territory (Spanish Main(land)) was all of the Caribbean lands bordering the Caribbean Sea, from Florida to the northern coast of South America.
The most important ports for the Spanish treasure ships were Veracruz in New Spain (Mexico), Porto Bello on the Isthmus in Panama, Cartagena de Indias in New Granada, and Maracaibo Venezuela.
From the 16th to the late 18th centuries, gold, silver, gems, spices, hardwoods, etc. were the main resources from the Pacific. They were brought by Spanish ship to the narrow land between the Pacific and the Atlantic, and carried overland by mule and reloaded on further Spanish ships for the journey to Spain. One of the most important resources was silver from the mines of Potosi in Bolivia.
This was the area that pirates and privateers roamed because the Spanish ships were such wealthy prizes if they could be captured. It was much easier to find them in the Caribbean than in the wide expanses of the Atlantic Ocean.
Because of the losses to these adventurers, the Spanish navy eventually organised the world's first convoys, where the treasure ships were protected by sailing together (in convoy) with a fleet of navy ships all around them. This was a very effective way of protecting them and has been used in wars ever since.