Medieval/Colonial European national borders seem to, as a rule, conform to geography. For instance, Germany having a border approximate with the Rhine, or the France/Spain border being approximate to the Pyrenees.
Therefore it seems odd that Portugal has (and continues) existed independently of Spain for an extremely long period of history. One would think that the Iberian peninsula forms a sort of "natural" geographic nation, so to speak, and thus it seems incongruous for Portugal to have existed within it despite sharing borders with a larger and quite militaristic neighbor.
hi! there's always room for more input, but FYI, there are a few previous related discussions in the FAQ*
Portugal and Spain on the Iberian peninsula
*see the link on the sidebar or the wiki tab