The deal is announced in Peshawar
The provincial government in north-west Pakistan has agreed to pull troops out of a valley under a peace agreement signed with pro-Taleban militants.
The authorities say they will also allow the militants to impose Sharia law in Swat in return for promises to close training camps and end attacks.
The deal is the first since a new government came to power promising to negotiate to end violence in the area.
Nato and the US say such deals have helped al-Qaeda and the Taleban.
The senior minister in the North West Frontier provincial government, Bashir Bilour, outlined the 15-point agreement signed in Peshawar.
Mr Bilour said the militants had agreed to stop suicide and bomb attacks on security forces and close down their camps.
They are also expected to hand over any foreign militants in the area and stop obstructing girls' education.
In return, Mr Bilour said the government would make limited concessions on militant demands for the imposition of Islamic law in the region, the Associated Press reports.
The government would also release prisoners as well as "gradually" withdraw troops from Swat.
"We hope this agreement will help bring peace in Swat," said Mr Bilour, who headed the government's negotiating team.
He was speaking to reporters outside the government building in the city where talks had taken place.
Nato is alarmed at deals between militants and Pakistan's government
Ali Bakhsh, one of the militants' representatives in negotiations, said he was fully satisfied with the agreement, Reuters news agency reports.
Pakistan has been heavily criticised for previous deals with militants near the Afghan border.
On Tuesday, US Deputy Secretary of State John Negroponte said the US had advised Pakistan not to negotiate with militants.
"We have real reservations about negotiated agreements with extremists," he told the Senate Foreign Relations Committee.
"There is a lot at stake here and we have made the point repeatedly."
Last week Nato criticised the deals, saying cross-border attacks in Afghanistan are on the rise.
The Swat valley, in North-West Frontier Province, was a prominent destination for tourists until a Taleban-style insurgency last year that tried to impose Sharia law.
Military officials claim to have crushed the rebellion after sending in thousands of troops.
Hundreds of people have been killed in Swat, and thousands displaced. Hundreds more have died in militant attacks elsewhere in Pakistan over the past year.
Pakistan's new civilian government has said it will deal with Islamic militancy through dialogue and development and is seeking deals with militants across the north-west and tribal areas.
The NWFP government was elected on a platform of negotiating with the Taleban and argues that military policies have served only to strengthen the militants.
Insurgents in Swat are led by a pro-Taleban cleric Maulana Fazlullah.
The BBC's Syed Shoaib Hasan in Islamabad says the deal gives him considerable power in one of Pakistan's most scenic regions, although it remains silent on his own status.
The militants had demanded an amnesty for the wanted cleric, whose whereabouts are currently unknown.