After Columbus arrival at the "West Indies", a division of influence became necessary to avoid conflict between Spanish and Portuguese. This was resolved in 1494, with the Treaty of Tordesillas that "divided" the world between the two powers
In 1493 the Catholic kings of Portugal and Spain had got from Pope Alexander VI a bull (Inter caetera) stating that all lands west and south of a pole-to-pole line 100 leagues west and south of the Azores or the Cape Verde Islands should belong to Spain and, later, all mainlands and islands then belonging to India. It did not mention Portugal, which could not claim newly discovered lands east of the line. King John II of Portugal was not pleased with the arrangement, feeling that it gave him far too little land — preventing him from reaching India, his main goal. He then negotiated directly with King Ferdinand and Queen Isabella of Spain to move the line west, allowing him to claim newly discovered lands east of it.
In the Treaty of Tordesillas, the Portuguese "received" everything outside of Europe east of a line that ran 270 leagues west of the Cape Verde islands; this gave them control over Africa, Asia and eastern South America (Brazil). The Spanish received everything west of this line, territory that was still almost completely unknown, and proved to be mostly the western part of the American continent plus the Pacific Ocean islands.
England of course had already broken with the Catholic Church and wasn't covered in the treaty... so for England and Spain the rule was "Who gets there first owns it... and has to HOLD it."