Eritrea and Ethiopia are to re-establish diplomatic and trade ties after two decades of hostility.
Ethiopian Prime Minister Abiy Ahmed and Eritrean President Isaias Afewerki made the announcement during a landmark meeting in Eritrea's capital, Asmara.
It is the first time the leaders from the two East African neighbours have met in almost 20 years.
Relations were severed following a border dispute which killed tens of thousands of people in the late 1990s.
A peace deal was signed in December 2000. However, Ethiopia refused to accept the final ruling of a border commission two years later, which awarded disputed territory to Eritrea, including the town of Badme.
A "no war, no peace" situation has existed between the two countries ever since.
Eritrea has national conscription, which can last indefinitely. This is one of the main reasons why so many Eritreans try to leave the country and seek asylum elsewhere.
Sunday's meeting, which follows a visit to the Ethiopian capital, Addis Ababa, by an Eritrean delegation, comes after Mr Abiy said his country would accept the commission's ruling.
This diplomatic initiative is the latest in a series of changes introduced by the Ethiopian prime minister since he came into office in April. Before then, it was unthinkable for Ethiopia to accept that Badme, the flashpoint for the conflict, was part of Eritrea.
Mr Abiy has also lifted a state of emergency, freed political prisoners and announced economic reforms.
In speeches broadcast live on state television on Sunday, Prime Minister Abiy and President Isaias said they had agreed to re-open embassies in their respective capitals, while landlocked Ethiopia will be allowed to use Eritrean ports on the Red Sea.
The two countries will also resume flights between each other, as well as direct phone connections.
The meeting was greeted with excitement in Eritrea, where thousands of people lined the streets singing and waving both countries' flags.
From The Airport to the State House in #Asmara’s streets, the Ethiopian delegation was greeted & received with overwhelming joy & love by the kind people of Eritrea. The yearning for peace was palpable & we’ll decidedly move forward for the good of our people. #Ethiopia #Eritrea pic.twitter.com/jzu7XBHW8x— Fitsum Arega (@fitsumaregaa) July 8, 2018
The goodwill appeared to be shared by the leaders, who were pictured smiling broadly together in images shared by Mr Abiy's chief of staff, Fitsum Arega, on his Twitter account.
Speaking at a dinner held in his honour, Mr Abiy said "war and talk of war must end".
"Today, the Eritrean people, particularly the people of Asmara, practically showed us how stronger love is than the missiles of the day," he added.
"Missiles, tanks, Kalashnikov and bren [light machine guns] can capture people but not their hearts. What can capture the human heart is love."
However, the BBC's Emmanuel Igunza in Addis Ababa says, despite all the optimism, it is not clear when Ethiopian troops will withdraw from the disputed territories.