The agreement came as Germany, Spain and Greece reached a trilateral migration deal of “reciprocal cooperation”, along with a wider EU migration agreement.
The wider EU migration agreement aims to minimise the “secondary movements” of migrants, who register in one EU country and then cross into another.
The German Chancellor struck the deals with Hungary, Belgium, France, Finland, Latvia, Lithuania, the Netherlands, Sweden, Portugal, Poland, the Czech Republic, Denmark, Estonia and Luxembourg, according to DPA.
Asylum seekers whose “first entry into the European Union was Spain” will be returned by Germany to Spain, the Spanish government said in a written statement.
Germany will also pay for the cost of their return.
Ms Merkel made requests for the agreement during the EU summit in meetings on the sidelines with Greek Prime Minister Alexis Tsipras and Spanish Prime Minister Pedro Sanchez, Spain said.
In return, Ms Merkel will give the go ahead for family reunification to take place in Germany.
The move will see 2,900 people who presently live in Greece, reunited with their families in Germany, according to Greek newspaper Kathimerini.
The Greek Prime Minister said he is confident the country could manage the arrival of asylum seekers, as currently, about 100-150 people are leaving Greece for Germany every month.
And Spain and Germany will aid Greece in the event of a new migration crisis, by committing to promote EU initiatives.
The two countries will also delay a VAT-rate increase as part of a pan to lend financial assistance to the five eastern Aegean islands.
But Greece argued the move could be damaging for the island economies, according to a report.