China and the United States have formally agreed to the setting up of a military hotline.
The issue was discussed last year when Mr Gates visited China
The link, to prevent military misunderstandings becoming crises, is expected start operating soon.
The deal was signed at a meeting of senior US and Chinese defence officials in Shanghai.
Establishing a hotline has been long planned and was last discussed during a visit to China in November by the US defence secretary, Robert Gates.
"The agreement will allow us to move forward on installing the actual equipment in the next few weeks," said a statement from the US defence department.
It is the first time China has agreed to such a link between its defence ministry and that of another country, and it is hoped the move will prevent a repeat of some of the problems which have dogged military relations between Beijing and Washington.
In 2001, relations plummeted after a collision between a Chinese fighter jet and a US spy plane over the South China Sea.
The Shanghai meeting also saw the signing of an accord which will allow US officials to search Chinese military archives for information on thousands of US servicemen missing since WWII.
It is thought the agreement could help establish the fate of those who went missing in action during the Korean War. China supported the North Korean side and ran some prisoner-of-war camps.