The accord was initialled by President Faustin Archange Touadera for the CAR government and representatives of militias which control most of the country.
It will be formally signed in the CAR capital of Bangui "in the coming days," Touadera's office said, without announcing a date.
"The Khartoum Agreement opens the door for peace to return to our homeland," Touadera declared at the ceremony. "It is now time to open a new page for Central Africa. Let's go together to Bangui to build our country together."
The agreement, brokered by the African Union after 18 months of exploratory work and sponsored by the UN, is the eighth attempt in almost six years to forge peace.
Thousands of people have been killed and a quarter of the population of 4.5 million have fled their homes.
The UN says unrest has driven so many people from their farms that hundreds of thousands are at risk of famine.
Herbert Gontran Djono Ahaba, speaking on behalf of the armed groups, said: "The difficult time starts now, and that is implementing the Khartoum Agreement... This agreement is crucial for peace."
The text of the agreement was not immediately made public, and there was no word on what compromises may have been needed to achieve it.
"The contents will be made public after the signature," the head of the CAR government delegation, Firmin Ngrebada, said.
Past stumbling blocks in peace negotiations have include rebel demands for an amnesty, something that the CAR government, under pressure from Western allies, has refused.
The history of peace making in the CAR is littered with failures. All seven previous agreements have failed to stick.
The last attempt, in 2017, was forged with the help of the Catholic church, but fighting resumed within a day, leaving a hundred people killed in the central town of Bria.
The CAR began its nightmare descent in 2012, when a mainly Muslim rebel movement called the Seleka rose in the country's north.
The following year, insurgents overthrew President Francois Bozize, a Christian -- a move that triggered the rise of a predominantly Christian militia called the anti-Balaka.
Fearing a Rwandan-style genocide, former colonial ruler France intervened militarily under a UN mandate.
The Seleka were forced from power and in February 2016, Touadera, a former prime minister, was elected president.
But Touadera only controls a fraction of the state, with an estimated 80 percent of the country held by militias who fight over mineral wealth -- a hoard that ranges from gold to uranium and diamonds.