The deal does not allow Indian lorries to deliver goods to Afghanistan, owing to the long-standing conflict between Pakistan and India.
"A major step"
The agreement had been under negotiation for years. Hamid Karzai, the Afghan president, and Asif Ali Zardari, his Pakistani counterpart, had once promised that it would be signed by the end of 2009, a deadline they missed.
US officials have conducted several meetings with both sides in recent weeks to encourage them to sign the deal.
Karzai hailed the deal as a "major step" for both countries in a statement released on Monday.
"Karzai congratulated people of both countries on the signing of the agreement, and called it a major step for the regional trade and for the path of its development," the statement said.
Hillary Clinton, the US secretary of state - currently in Islamabad for high-level meetings - attended the signing ceremony on Sunday night.
"Bringing Islamabad and Kabul together has been a goal of this administration from the beginning," Richard Holbrooke, the US special envoy to Afghanistan and Pakistan, said. "This is a vivid demonstration of the two countries coming closer together."
Afghanistan is a landlocked country, and much of its trade depends on neighbouring Pakistan. The long-standing Afghan Transit Trade Agreement already allows Afghan companies to import goods duty-free via Pakistani ports.