Indian and Chinese troops have been confronting each other at the Doklam plateau near the borders of India, its ally Bhutan and China, in the most serious and prolonged standoff in decades along their disputed Himalayan border.
The Indian ministry said the two sides had agreed to defuse the crisis following diplomatic talks.
"In recent weeks, India and China have maintained diplomatic communication in respect of the incident at Doklam," the ministry said in a statement.
"On this basis, expeditious disengagement of border personnel at the face-off site at Doklam has been agreed to and is on-going," it said in a statement.
It did not offer more details of the terms of disengagement from the area which had raised fears of a wider conflict between the Asian giants who fought a brief border war in 1962.
China said Indian troops had withdrawn from the remote area in the eastern Himalayas.
Chinese foreign ministry spokeswoman Hua Chunying said Chinese troops would continue to patrol the Doklam region.
"China will continue to exercise sovereignty rights to protect territorial sovereignty in accordance with the rules of the historical boundary," she said.
India and China have been unable to settle their 3,500-km (2,175-mile) frontier and large parts of territory are claimed by both sides.
"China hopes India respects the historical boundary and works with China to protect peace along the border on the basis of mutual respect of each other's sovereignty," Hua added.
The trouble started in June when India sent troops to stop China building a road in the Doklam area, which is remote, uninhabited territory claimed by both China and Bhutan.