The Yemen government has deployed troops in the northern province of Saada to monitor a ceasefire between Shia Houthis and Sunni Salafis, a security official said.
The deal brokered late on Friday by a presidential commission ends fighting that erupted in late October centred on a Salafi mosque and Quranic school in the town of Dammaj.
The deadly conflict had spread in the northern provinces, embroiling Sunni tribes wary of the Shia rebels, known as Houthis, who have been accused of receiving support from Iran.
The deal stipulated the two sides would withdraw from the areas around Dammaj to be replaced by army troops who would monitor the ceasefire, said Yahya Abu Isba, head of the presidential mediation commission.
"This agreement ends the military conflict between the Houthis and the Salafi in Dammaj and prevents a sectarian war that was looming over Yemen," he told state television.
A number of previous ceasefires have failed to stick. But Yehia Abuesbaa, head of the committee, said the latest had a better chance of holding because it included all factions involved in the fighting in Saada and adjacent provinces.
More than 100 people have been killed since fighting erupted on October 30 when the Houthi rebels who control much of Saada province on the Saudi border accused Salafis in Dammaj of recruiting thousands of foreign fighters to prepare to attack them.
The Salafis say the foreigners at the Dar al-Hadith school are students seeking to deepen their knowledge of Islam.
A lull in fighting after the Yemeni army started to deploy enabled the Red Cross to evacuate 25 wounded people from Dammaj.
The wounded, some of whom are in a critical condition, have been airlifted from Saada airport to Sanaa, the spokeswoman for the International Committee of the Red Cross in Yemen, Marie Claire Feghali, told the AFP news agency.
On Wednesday, a presidential commission also brokered a ceasefire between the Houthis and gunmen from the powerful Hashid tribes, ending two days of clashes in the northern province of Amran.
The Houthi-Salafi conflict has compounded the challenges facing US-allied Yemen, which is also grappling with separatist movement in the south and an insurgency by fighters linked to al-Qaeda.
A bomb blew up on Saturday in the capital Sanaa near the house of a powerful general, Ali Mohsen al-Ahmar, hours after a similar one was dismantled nearby, but there were no casualties, security sources said.
Ahmar, who sided with opponents of veteran President Ali Abdullah Saleh before he stepped down under pressure from mass protests in 2012, is a military adviser to the current President, Abd-Rabbu Mansour Hadi.