A spokeswoman for the German Interior Ministry said Wednesday that an agreement had been made to send back to Spain some migrants arriving in Germany.
Eleonore Petermann said the deal had been signed by the German and Spanish interior ministries on Monday. Spain had not asked for anything from Germany in return, she said.
The announcement covers migrants who have registered as refugees in Spain, with their data recorded in the European Dactyloscopy (Eurodac) fingerprint database for identifying asylum-seekers and people crossing borders in an irregular manner.
The agreement means that people arriving from Spain can be returned there within 48 hours of arrival at the German border. The bilateral agreement is due to come into force on Saturday.
Also this weekend, German Chancellor Angela Merkel is due to visit Spain to meet with Prime Minister Pedro Sanchez.
It is the first such agreement to be made, although Interior Minister Horst Seehofer has said he wants to draw up similar arrangements with other European countries. Petermann said similar bilateral agreements were being negotiated with Greece and Italy.
Under European Union rules, migrants arriving in the EU should register and their application be processed in the country where they make their initial entry.
Managing migrant arrivals in Europe
An increasing number of migrants have made their way from North Africa to Europe via Spain this year.
There is pressure on the coalition government in Germany to avoid the situation seen in 2015, when nearly 900,000 people entered the country, fleeing war and poverty in the Middle East, Asia and Africa.
Over the past month, the Interior Ministry under Seehofer has set up transit centers on the border separating Austria from Seehofer's home state of Bavaria, and "Anker" centers to hold and process asylum seekers.
jm/rt (dpa, EPD)