Officials in both countries expressed satisfaction with the judgment, the Bangkok Post reported.
The international court's ruling largely dealt with technical issues unresolved since France, then the ruler of Cambodia, failed to come to agreement with Thailand about the location of the border in that region in 1904. In later decades, that led to Cambodia and Thailand engaging in skirmishes over the rights to the temple of Preah Vihear, which was built in the 11th and 12th centuries.
In 1962, the court established a boundary for the temple that put it in Cambodian territory. It ruled Thailand had an "explicit obligation" to pull troops from the "vicinity" of the temple and an "implicit obligation" not to send troops back into the region.
Thai troops and police continued to occupy the temple, however. During a five-day hearing in April, Thailand asked the court to define the word "vicinity," noting the court had not established a boundary between the countries in 1962.
On Monday, the court said in a 37-page opinion that Cambodian sovereignty covered all of the promontory on which the temple was located, but not as far as a nearby hill Cambodia called Phnum Trap and Thailand refers to as Phu Makua.
The ruling means the countries still must negotiate on where their borders are in that region.
The ruling was a victory for Thailand because its legal team "convinced the court not to rule on the sovereignty of the disputed territory," said Puongthong Pawakapan, a political scientist at Thailand's Chulalongkorn University.
Cambodian officials also claimed success.
"This is the victory of all the nation and the reward to the political maturity of the current royal government of Cambodia," Information Minister Khieu Kanharith wrote on Facebook.
The temple was declared a UNESCO World Heritage site in 2008.