The presidents of Ecuador (left) and Colombia had traded accusations

The crisis had been triggered by a cross-border raid by Colombian troops into Ecuador to attack Farc rebels.

Earlier there had been heated exchanges between the heads of state at the Rio Group summit in the Dominican Republic.

The summit of Latin American leaders had originally been planned to discuss energy and other issues.

But the crisis, which started with the raid last Saturday, had erupted into the worst political spat in the region for years.

Venezuela and Ecuador cut diplomatic ties with Bogota and sent troops to their borders after the Colombian operation which left 20 Farc rebels dead, including a senior Farc commander, Raul Reyes.

As the summit debate unfolded, Colombia's defence minister announced that another rebel leader, Ivan Rios, had been killed - this time on Colombian soil and at the hands of his own men.

Verbal sparring

Nicaragua's President Daniel Ortega, who had also broken off diplomatic ties with Colombia, said they would be re-established after the presidents shook hands.

The handshakes were broadcast live on television across Latin America in response to a special request from the summit's host, Dominican Republic President Leonel Fernandez.

Ecuadorean President Rafael Correa and his Colombian counterpart Alvaro Uribe had clashed at the opening of the summit.

Mr Correa condemned Colombia's "aggression", while Mr Uribe accused his opposite number of having links with the Farc rebels.

The Colombian president said he had not warned Ecuador before the raid because Mr Correa had not co-operated in the fight against terrorism.

He also claimed material seized in the operation proved links between Mr Correa's government and the rebels.

Mr Correa rejected the claims, saying his hands were not "stained with blood".

He admitted there had been communications with Farc, but only because his government was trying to secure the release of hostages held by the rebels, including former Colombian presidential candidate Ingrid Betancourt.

But before shaking hands, to applause from the summit delegates, Mr Correa said: "With the commitment of never attacking a brother country again and by asking forgiveness, we can consider this very serious incident resolved."

The BBC's Jeremy McDermott says President Uribe's huge gamble in ordering the air strike that killed Reyes appears to have paid off.

He said Mr Uribe knew it would lead to a diplomatic incident with Ecuador, but perhaps did not realise that Venezuela and Nicaragua would also break off diplomatic relations.