Italy's prime minister Giuseppe Conte said his country was "at last", no longer alone.
After the deal was reached Macron said European cooperation had won the day.
"There's a will to better protect the borders, to strengthen the rules of reception," he said.
The 28 leaders agreed to consider setting up "disembarkation platforms" outside the bloc, most probably in north Africa, in a bid to discourage migrants boarding EU-bound smuggler boats.
Member countries could set up migrant processing centres -- but only on a voluntary basis -- to determine whether to admit arrivals as refugees or turn them away as "economic migrants".
The summit also offered a concession to German Chancellor Merkel, who faces a rebellion from within her own coalition government, with moves to stop migrants registered in Italy and other EU countries from moving to Germany.
"After intensive discussion on what is perhaps the most challenging issue for the European Union, it is a good message that we have adopted a joint text," Merkel said.
She had earlier warned that "migration could end up determining Europe's destiny" if it failed to reach an agreement.
As the summit got underway, EU president Donald Tusk issued a fresh warning on the need for action on migration to stave off rising populism and authoritarianism, saying that "the stakes are high and time is short".
This applies to eastern European countries, in particular Hungary and Poland which are reticient to share the burden of migrant quotas to help allieviate southern nations.