India said on Monday it had agreed with China to end a months-long military stand-off at a strategically important disputed area in the Himalayas and troops had begun disengaging.
India's foreign ministry said it had reached an "understanding" after talks with Beijing about the tense confrontation in an area near the Indian border that is claimed by both China and Bhutan.
It suggested that both sides had agreed to pull back, although the Chinese foreign ministry said only that Indian troops were withdrawing.
"India and China have maintained diplomatic communication in respect of the incident at Doklam," New Delhi said in a statement referring to the stand-off which began on June 16.
"During these communications, we were able to express our views and convey our concerns and interests.
"Expeditious disengagement of border personnel at the face-off site at Doklam has been agreed to and is ongoing."
India does not claim Doklam for itself but is closely allied with Bhutan, which it regards as a buffer against rival China to the north.
India and China have a long history of mistrust and went to war in 1962 over the Indian state of Arunachal Pradesh.
But analysts had said the latest crisis between the nuclear-armed neighbours was the worst in decades.
China said it was "pleased" that India had agreed to withdraw troops from the flashpoint area.
"I am pleased to confirm that trespassing Indian personnel have all pulled back to the Indian side of the boundary," foreign ministry spokeswoman Hua Chunying said.
"Chinese troops continue to patrol on the Chinese side of the boundary," she said.
China had repeatedly said India must withdraw its troops before any proper negotiation takes place. India said both sides should withdraw their forces together.
The border trouble began in June when Chinese soldiers started to extend a road through the Doklam territory - known as "Donglang" in Chinese.
India deployed troops to stop the construction project, prompting Beijing to accuse it of trespassing on Chinese soil.
The plateau is strategically significant as it gives China access to the so-called "chicken's neck" - a thin strip of land connecting India's north-eastern states with the rest of the country.
Another incident elsewhere earlier this month, in which Indian and Chinese soldiers fought with rocks and sticks at a high-altitude lake on the disputed border between the two countries, further inflamed tensions.
India has historically been closely allied to Bhutan, but in recent years China has sought to increase its own engagement with the tiny mountainous kingdom, which has fed into a broader competition for regional influence between the two Asian powers.
Monday's announcement comes days before India's prime minister Narendra Modi is expected to travel to China for a summit of BRICS countries - Brazil, Russia, India, China and South Africa.