Chile and Bolivia have agreed on the status of a river both countries claim rights to, the International Court of Justice said on Thursday.
Chile earlier asked the UN's highest court to declare the Silala River an "international water course" but the judges said they no longer needed to rule on the climate-fuelled row.
"It is an international watercourse, as both parties now agree,'' the court's president, US judge Joan E. Donoghue, said.
The court urged the South American neighboring countries to continue working together as a "shared resource can only be protected through cooperation."
Chile and Bolivia both claimed victory
"Chile went to the court for judicial certainty and got it," President Gabriel Boric said.
"Today, after this ruling, we can focus on what unites us and not on what separates us," Boric said.
He added the court confirmed that the Silala river is an international watercourse governed by international law.
Bolivia had initially rejected this designation but said it was now happy the country has equitable and reasonable use of the Silala river.
"From now on based on the ruling, Bolivia will exercise its rights it has over the waters of the Silala river," Bolivia's minister of foreign affairs, Rogelio Mayta, said.
One of the driest places on Earth
The Silala River flows for five miles (eight kilometers) from Bolivia's high-altitude wetlands into Chile's Atacama desert.
Drought-stricken Chile and landlocked Bolivia vowed to focus on preserving the scarce water resource.
Chile is currently in a 13-year "Mega Drought" that is the longest in at least 1,000 years and threatens the country's freshwater resources.
In Bolivia, the Pantanal, the world's largest wetlands which also span Brazil and Paraguay, is experiencing its worst drought in 47 years
lo/jcg (AFP, AP, Reuters)