[1] Most notably, Spain and Portugal expressly abandoned the papal bull, Inter caetera, and the treaties of Tordesillas and Zaragoza as the legal basis for colonial division.
Starting in the 17th century, Portuguese explorers, traders, and missionaries from the state of Maranhao in the north, and gold-seekers and slave-hunters (the famous bandeirantes of São Paulo} in the south, had penetrated far to the west and south-west of the old treaty line, also looking for slaves.
New captaincies (administrative divisions) created by the Portuguese beyond Brazil's previously-established boundaries: Minas Gerais, Goias, Mato Grosso, and Santa Catarina.
They also sought to transfer to Spain the Portuguese colony of Sacramento, which had functioned as a back door for the illegal Anglo-Portuguese trade with the Viceroyalty of Peru, and which rendered the Spanish city of Buenos Aires dangerously exposed to foreign invasion.
The Treaty of Madrid was based on the principles of Uti possidetis, ita possideatis from Roman law ("who owns by fact owns by right") and "natural boundaries", stating respectively in the preamble: "each party must stay with what it now holds" and "the boundaries of the two Domains... are the sources and courses of the most notable rivers and mountains", and thereby authorizing the Portuguese to retain the lands they had occupied at the expense of the Empire of Spain.
The treaty sensibly sought to follow geographic features in fixing the boundary: it moved westward from a point on the Atlantic coast south of Rio Grande do Sul, then northward irregularly following parts of the Uruguay, Iguaçu, Paraná, Paraguay, Guapore, Madeira, and Javari Rivers, and north of the Amazon, ran from the middle Negro to the watershed between the Amazon and Orinoco basins and along the Guiana watershed to the Atlantic.