A peace deal ending the 1998-2000 border conflict has never been fully implemented and there has been tension between the neighbours ever since.
The countries have also agreed to re-establish trade and diplomatic ties.
Family members divided by the dispute are now able to telephone each other for the first time since the war.
Ethiopian journalist Shishay Wores was contacted by one of his brothers in Eritrea.
“For a moment my heart stopped beating, my voice was shaking and I was struggling for words. It took me a while to calm down and talk to my brother.”
The declaration came at a landmark meeting between the two countries’ leaders in Eritrea’s capital, Asmara.
The summit between Eritrea’s President Isaias Afewerki and Ethiopia’s Prime Minister Abiy Ahmed marked the first time the neighbours’ heads of state had met for nearly two decades.
Why is this such a big deal?
A border commission set up under the peace agreement ruled that the town of Badme, the flashpoint for the conflict, was part of Eritrea but Ethiopia refused to accept this and so normal relations were never resumed.
The rivalry affected the whole region with each country normally taking opposite positions whatever the question. They also took rival sides in Somalia’s long conflict – Eritrea was accused of backing Islamist groups, while Ethiopia, a US ally, supported the internationally recognised government.
Until now, Eritrea has always said that war could resume at any time and so had national conscription, which could last indefinitely. This is one of the main reasons why so many Eritreans try to leave the country and seek asylum elsewhere.
When Abiy Ahmed took over as prime minister of Ethiopia three months ago, he indicated that change could be on the cards but few imagined it could happen this quickly, says BBC Tigrinya editor Samuel Ghebrehiwet,
As well as his overtures to Eritrea, Mr Abiy has lifted a state of emergency, freed political prisoners and announced economic reforms.
What are people saying about it?
Mr Abiy’s surprise visit to Asmara, that began on Sunday, was hailed as historic.
Asmara resident Mela Gebre Medhin said on Twitter that she had “goosebumps” thinking about what happened.