BERLIN (AP) — The German government says Greece has agreed to take back migrants who apply for asylum there and later turn up at Germany's border with Austria.

That brings the government closer to implementing a deal to defuse a German political spat over migration.

Interior Ministry spokeswoman Eleonore Petermann said Friday Germany and Greece have reached an agreement and need only a formal exchange of letters to complete it. She wouldn't give details ahead of its signing.

The deal with Greece follows an agreement with Spain that took effect last weekend. Petermann said talks with Italy are "far advanced."

In June, Interior Minister Horst Seehofer threatened to turn back previously registered migrants unilaterally at the German-Austrian border. Chancellor Angela Merkel insisted Germany must first reach agreements with other countries.