NATO will send ships to the Aegean Sea to combat people smuggling.
The alliance overcame ongoing tensions between Greece and Turkey to agree a deal after late night talks in Brussels.
Both countries had raised objectings, saying the mission could set a precedent in a dispute over territorial waters.
Under the agreement, neither country will operate in the other’s maritime zone.
NATO insists the mission is not to push back the boats carrying refugees.
But its vessels will return rescued migrants to Turkey.
The EU is counting on Turkey to stem the flow of people to its shores.
It has given Ankara three billion euros to help set up camps and provide services to people who have fled their home countries.