The announcement was broadcast live on Wednesday from Havana, Cuba, where peace talks have been held for almost four years.
The conflict has killed an estimated 260,000 people and displaced millions.
President Juan Manuel Santos called the deal “the beginning of the end to the suffering, pain and tragedy of war”.
‘War is over’
“The Colombian government and the Farc announce that we have reached a final, full and definitive accord,” Colombian government and Farc negotiators said in a joint statement.
The head of the Colombian delegation, Humberto de la Calle, and the chief Farc negotiator, Ivan Marquez, signed the agreement at a ceremony in Cuba.
Both sides have agreed to work together to address social exclusion, to deliver justice to the victims of the conflict and build a stable and enduring peace.
The agreement comes after two years of secret talks and almost four years of formal negotiations.
“We have reached our goal,” said Mr de la Calle.
“The war is over but also there is also new beginning. This agreement opens the door to a more inclusive society,” he added.
‘Die in peace’
In Bogota, hundreds of people, many dressed in white, gathered at different points of the city waving the Colombian flag and cheering.
“I can die in peace because finally I’ll see my country without violence with a future for my children,” 57-year-old Orlando Guevara told the Associated Press news agency.
Farc negotiator Ivan Marquez said the Farc and the government had “won the most beautiful of all battles: the peace of Colombia”.