ADDIS ABABA, Ethiopia — Eritrea’s longtime president arrived in Ethiopia on Saturday for his first visit in 22 years amid a surprise diplomatic thaw between the once bitter rivals.

Thousands turned out in Ethiopia’s capital, Addis Ababa, under tight security to welcome the president, Isaias Afwerki, whose visit is the latest step in ending a state of war.

“This is a historic day for all of us,” the Eritrean leader said at a luncheon with Ethiopia’s new prime minister, Abiy Ahmed, at the National Palace. “Anyone who thinks the people of Eritrea and Ethiopia are separated is considered as naïve from now on.”

Mr. Abiy broke the ice last month by fully embracing a peace deal that ended a two-year border conflict.