EU leaders have struck a deal on a huge post-coronavirus recovery package following a fourth night of talks.
It involves €750bn ($NZ1.3 trillion) in grants and loans to counter the impact of the pandemic in the 27-member bloc.
The talks saw a split between nations hardest hit by the virus and "frugal" members who were concerned about costs.
It is the biggest joint borrowing ever agreed by the EU. Summit chairman Charles Michel said it was a "pivotal moment" for Europe.
The deal centres on a €390b programme of grants to member states hardest hit by the pandemic. Italy and Spain are expected to be the main recipients.
A further €360b in low-interest loans will be available to members of the bloc.
The summit, which began in Brussels on Friday morning, saw more than 90 hours of talks and became the EU's longest since a 2000 meeting in the French city of Nice, which lasted for five days.
The package will now face more technical negotiations by member states, and need ratification by the European Parliament.
How did we get here?
Michel, the president of the European Council, tweeted "Deal" shortly after the 27 leaders reached the agreement at about 05:15 (03:15 GMT) on Tuesday.
The agreement followed a long weekend of talks between EU countries, during which tempers were often frayed.
Member states were largely split between those hit hardest by the outbreak and keen to revive their economies, and those more concerned about the costs of the recovery plan.
The self-proclaimed frugal four - Sweden, Denmark, Austria and the Netherlands - along with Finland, had opposed allowing €500b to be offered in the form of grants to countries hardest-hit by Covid-19.
The group originally set €375b as the limit, in addition to wanting conditions such as the right to block requests. Other members, such as Spain and Italy, did not want to go below €400b.
At one point French President Emmanuel Macron reportedly banged his fists on the table, as he told the "frugal four" he thought they were putting the European project in danger.
The €390b figure was suggested as a compromise, and "frugal" nations were reportedly won over by the promise of rebates on their contributions to the EU budget.
Another issue in the negotiations was how disbursements would be linked to governments respecting the rule of law. Hungary and Poland both threatened to veto the package if it adopted a policy of withholding funds from nations who do not meet certain democratic principles.
The European Commission will borrow the €750b on international markets and distribute the aid. There will also be a means by which member states can reject a spending plan.
The deal was reached alongside agreement on the bloc's next seven-year budget, worth about €1.1tn.
How have EU European leaders reacted?
French President Emmanuel Macron said it was a "historic day for Europe".
"Never before did the EU invest in the future like this," Belgian Prime Minister Sophie Wilmès tweeted.
Michel said: "We showed collective responsibility and solidarity and we show also our belief in our common future."
European Commission President Ursula von der Leyen tweeted. "Today we've taken a historic step, we all can be proud of. But other important steps remain. First and most important: to gain the support of the European Parliament. Nobody should take our European Union for granted."
Dutch Prime Minister Mark Rutte, who led the "frugal group", welcomed the agreement, but acknowledged the fractious nature of the talks. "We are all professionals, we can take a few punches," he told reporters.
- BBC