Mainstream European contact with Americas was started by, of course, Columbus, who was working for Spain. Columbus didn't hit every single island in the Caribbean, nor was the entire area claimed all at once, but it gave them some soil. By the point, Portugal had colonized several Atlantic islands, like the Azores and Cape Verde, that could also be used as bases to start traveling west.
So that started an argument: There was this vast new world, both countries were positioned well to start colonizing, and both countries wanted to colonize. They needed a way to establish claims. There were a series of treaties, culminating in the Treaty of Tordesillas a couple years after Columbus' first voyage. It created an imaginary north-south line halfway between the Spanish Caribbean and Portuguese Cape Verde, and said everything to the west could be colonized by Spain and everything to the east could be colonized by Portugal.
Almost all of the New World fell on the Spanish side of the line. However, if you look at a map of South America, you'll see it bulge towards the east... and that bulge is Brazil, which not coincidentally became a Portuguese colony.
The treaty ended up being more of a rough guideline than anything. Brazil slowly grew well west of the line, and Portugal had a loose colony on Barbados (a Caribbean colony ;-) ) for a few decades, but it effectively made the Caribbean a Spanish sea as far as Portugal was concerned.