Judges at the World Court ruled on Thursday that Chile and land-locked Bolivia now agreed on previous points of dispute over access to the waters of the Silala river and that they would not need to make a decision on Chile's claims before the court.
The judges urged the South American neighbours to work together on issues surrounding the frontier river, which runs through one of driest places on Earth, as such a "shared resource can only be protected through cooperation".
Speaking to reporters from La Moneda presidential palace in Santiago, Chilean President Gabriel Boric said the ruling gave Chile the legal certainty it was looking for.
Boric said the ruling confirmed that the Silala river is an international watercourse governed by international law.
"Chile went to the court for judicial certainty and got it," Boric said.
Bolivia's minister of foreign affairs, Rogelio Mayta, said the ruling gave Bolivia equitable and reasonable use of the Silala river.
"Today, the controversy over nature and use of the Silala river's waters has concluded," Mayta said in a statement. "And from now on based on the ruling, Bolivia will exercise its rights it has over the waters of the Silala river."
Chile had asked the court to rule that the Silala, which runs through the Atacama Desert, was an international waterway.
Judges said on Thursday that during the hearings it became clear that the states did not fundamentally disagree on the designation of the river or the fact that Chile should have access to its waters.
Bolivia and Chile cut off diplomatic ties decades ago over territorial disputes including Bolivia's calls for access to the sea. They have brought their long-running rivalry to The Hague court before.
In 2018, the court ruled in Chile's favour in a case brought by Bolivia seeking that Chile enter into negotiations over granting Bolivia a corridor to the sea.
The court, formally known as the International Court of Justice, is the United Nations' court for resolving disputes between states.
(Reporting by Stephanie van den Berg, additional reporting by Fabian Camber and Alexander Villegas in Santiago and Monica Machicao in La Paz; editing by Alison Williams and Nick Macfie)