Cambodia should have sovereignty over most of the disputed land around the Preah Vihear temple on the border with Thailand, the UN's top court has ruled.
The International Court of Justice in the Hague said Thailand must withdraw troops from around the hilltop temple.
But it did not give Cambodia all the disputed land, saying it had no jurisdiction to rule on a hill nearby.
Both governments welcomed the ruling, with the Thai prime minister calling on her people to accept the verdict.
In a televised address, Yingluck Shinawatra told Thais that both countries would work together to achieve peace.
Her Cambodian counterpart, Hun Sen, also addressed his nation, repeating a promise to work with Thailand to keep the border peaceful and "not do anything that will lead to tension".
"This is a significant step forward... towards a peaceful resolution," he said.
The BBC's Jonah Fisher in Bangkok says the ruling was a qualified victory for Cambodia, and the two sides will now have to negotiate.
The 900-year-old Hindu temple is perched on a cliff in Cambodia, but more easily accessed from the Thai side.
Fears of violence
The long-standing rift has previously led to clashes between the two nations, which both lay claim to the land.
A 1962 verdict by the court declared the temple to be Cambodian, but did not rule on the area around it.
Cambodia sought a clarification of the ruling two years ago, after fighting erupted.
Delivering the judgement, Peter Tomka, president of the International Court of Justice, said the court had decided "that Cambodia had sovereignty over the whole territory of the promontory of Preah Vihear".
"In consequence, Thailand was under an obligation to withdraw from that territory the Thai military or police forces or other guards or keepers that were stationed there," he said.
Both sides agreed to withdraw troops from the disputed area in December 2011.
On Saturday, the chief of Cambodia's military forces on the Thailand border called an emergency meeting after Thai aircraft were seen flying low around disputed land near the temple.
However, Cambodian regional commander General Srey Deuk told the BBC he expected no problems with the Thai military after Monday's verdict.
He said no troop reinforcements had been brought up to the temple.
But fears remain about possible violence in border villages, stirred up by nationalist groups.
One Thai nationalist group, the Thai Patriotic Network, has said it will reject any judgement from the ICJ, according to The Nation newspaper. The group has already petitioned the court to throw out the case.
The territory has been a point of contention for over a century.
The decision to award the temple to Cambodia in 1962 rankled Thailand, but the issue lay largely moribund due to Cambodia's civil war, which only ended in the 1990s.
It came to the forefront again when Cambodia applied for Unesco World Heritage status in 2008, which it won - angering Thai nationalists. Both sides began a build-up of troops in the area.
The ICJ ruling is an interpretation of the 1962 judgement and cannot be appealed.