Tensions have flared in recent weeks between the two regional powers over their 3,500-kilometre (2,200-mile) frontier, which has never been properly demarcated.
Thousands of troops from both countries are involved in the face-off concentrated in India’s Ladakh region, just opposite Tibet.
“Both sides agreed to peacefully resolve the situation in the border areas in accordance with various bilateral agreements,” the foreign ministry said in a statement, AFP reported.
The ministry added that the commanders agreed an “early resolution” was “essential” for bilateral relations between the world’s two most-populous nations.
“Accordingly, the two sides will continue the military and diplomatic engagements to resolve the situation and to ensure peace and tranquility in the border areas,” the statement said.
There have been numerous face-offs and brawls between Chinese and Indian soldiers at the frontier, but they have become more frequent in recent years.
On May 9, several Indian and Chinese soldiers were injured in a high-altitude cross-border clash involving fists and stone-throwing in Sikkim state.
Indian officials said that within days, Chinese troops encroached over the demarcation line in the Ladakh region, further to the west.
India moved extra troops to positions opposite.
The talks, which took place in the Chushul-Moldo region between the two commanders, is believed to be the highest-level meeting since the Sikkim exchange.
India’s Prime Minister Narendra Modi and his Chinese counterpart Xi Jinping have sought to ease the tensions at summits over the past two years when they agreed to boost border communications between their militaries.