Treaty of Madrid
The boundary between the Portuguese and Spanish domination of the Amazon was eventually fixed at the Rio Javari (river that rises on the border between Amazonas state, Brazil, and Loreto department, Peru) by the Treaty of Madrid in 1750.