Nigerian presidential candidates and their political parties signed a covenant promising to work for a peaceful vote before the elections in February 2019.
The agreement was negotiated by the National Peace Committee led by former Nigerian army chief Abdussalami Abubakar.
However, opposition leader Atiku Abubakar of the Popular Democratic Party (PDP) boycotted the signing ceremony in Abuja on Tuesday.
Senior Christian and Islamic religious leaders from Nigeria and diplomats attended the ceremony.
A similar agreement ensured a relatively peaceful election in 2015. The election marked the first victory of an opposition candidate in the history of the country.
Elections in Nigeria have long been marred by violence often fueled by ethnic, identity or religious tensions.