The Treaty of Alcañices (1297) (Tratado de Alcanizes in Portuguese) was made in Alcañices between King Denis of Portugal and King Fernando IV of Castile.
Denis was the grandson of king Alfonso X of Castile and essentially an administrator and not a warrior king. He went to war with the kingdom of Castile in 1295, relinquishing the villages of Serpa and Moura, but gained Olivença and reaffirmed Portugal’s possession of the Algarve and defined the modern borders between the two Iberian countries. The treaty also established an alliance of friendship and mutual defense, leading to a peace of 40 years between the two nations.
Fernando then married Denis's daughter, Infanta Constance of Portugal, making her Queen of Castile.