Venezuela’s President Nicolas Maduro and his Colombian counterpart, Juan Manuel Santos, have agreed to gradually reopen their common border after talks in Ecuador.
Venezuela closed the Colombian border a month ago and launched a major anti-smuggling operation.
Nicolas Maduro says smuggling has led to shortages in parts of Venezuela.
Meeting in Ecuador, Nicolas Maduro and Juan Manuel Santos also said they would return ambassadors to each other’s capitals immediately.
Some 20,000 Colombians have left Venezuela since the crisis began.
Most of the others fled in fear, many carrying their personal belongings over the border rivers.
“Common sense, dialogue and peace between our peoples and our countries have triumphed today,” said Nicolas Maduro after the talks in Quito.
For his part, Juan Manuel Santos said Venezuela “should have respected the rights of Colombians” who had to leave the country and return over the border.
The Colombian leader added: “I agree that criminal organizations working in the border area is a big problem, but the best way to deal with it is by working together.”
Most crossings were closed and some 3,000 Venezuelan troops have been deployed along the border since Nicolas Maduro launched a major anti-smuggling operation 19 August.
For many years, heavily subsidized items from Venezuela, including cheap petrol, have been sold at huge profit over the border in Colombia.
Nicolas Maduro says smuggling has led to shortages in the west of Venezuela and other parts of the country.
The talks on September 21 were facilitated by Uruguayan President Tabare Vasquez and his Ecuadorean counterpart, Rafael Correa.
The summit was preceded by two meetings between the Colombian and the Venezuelan foreign ministers.