You wouldn't know it now to look at them, but at one point Spain and Portugal were the biggest superpowers in the world. So when the New World was discovered, you best believe that they were all over that shit like filth on a hobo. Unfortunately, property law of the day was pretty much limited to shouting, "But I was here first!" and then taking all plaintiffs to the High Court of Abdomen Stabbing.
So the land-grab turned into a big ol' funny hat-wearing slap-fight until eventually, both governments were fed up and sat down to negotiate terms peacefully. The solution they came up with, which they called the Treaty of Tordesillas, was based on logic straight out of a Three's Company episode: They simply pulled out a map of the New World, drew a line down the center, and let the Spanish have everything to the West while the Portuguese got all the stuff to the East.
Which seems fair enough... until you look at that same line on a modern-day map: