Updated

After a tense meeting, the presidents of Venezuela and Guyana agreed Sunday to restore ambassadors and hold talks to resolve a long-running border dispute that flared up recently following the discovery of oil in disputed waters.

Venezuelan President Nicolas Maduro and Guyanese President David Granger met for the first time in New York in talks mediated by U.N. Secretary-General Ban Ki-moon during the world body's general assembly.

The current border between the South American countries was determined by international arbitration in 1899, but Venezuela has disputed that line for more than a half century and claims about 40 percent of Guyana's territory that is rich in gold, bauxite, diamonds and other natural resources. It extended its maritime claims recently after a subsidiary of Exxon Mobil Corp. announced it made a significant oil discovery off Guyana's coast.

The countries have been without ambassadors since earlier this year and tensions increased over the past week.

Guyana held military exercises around the country on Saturday, after it accused Venezuela of deploying troops to its border. Venezuelan officials have said only that troops were conducting exercises in the country's east and Guyana said its troop movements were not aimed at inflaming the situation.

"For now the ambassadors are returning," Maduro told reporters after the meeting at U.N. headquarters. "I'm going to start to communicate, to call President Granger, until we have a close relationship and dialogue accompanied by our Caribbean brothers."

A U.N. statement said the two presidents expressed a "willingness to continue to engage in dialogue," and would receive their respective ambassadors for a return to full diplomatic representation.

Granger, in a video posted on the YouTube channel of Guyana's presidency, said Venezuela was the first to recall its ambassador and then didn't accept Guyana's nominee as ambassador to Caracas.

"All of the provocations come from the Venezuelans. There has not been any lack of conversation on our part," he said.

Guyana maintains that the matter was settled by the 1899 arbitration. Venezuela appealed that ruling to the United nations in 1962.

Maduro described the meeting with Granger as "complex, tense, difficult," but he said it appeared to have opened a path for dialogue.