The US and Nato allies have agreed to withdraw all troops within 14 months if the militants uphold the deal.
President Trump said the US was "working to finally end America's longest war and bring our troops back home".
Talks between the Afghan government and the Taliban are due to follow.
US Secretary of State Mike Pompeo and leaders of the hardline Islamic movement attended the signing ceremony in Doha in Qatar.
Under the agreement, the militants also agreed not to allow al-Qaeda or any other extremist group to operate in the areas they control.
The US invaded Afghanistan weeks after the September 2001 attacks in New York by the Afghanistan-based al-Qaeda group.
More than 2,400 US troops have been killed during the conflict. About 12,000 are still stationed in the country. President Trump has promised to put an end to the conflict.
What happened in Doha?