The leaders of the two countries reach an agreement to ease a row that has fuelled an economic slowdown.