All 27 EU leaders have agreed a €50bn aid package for Ukraine after Hungary had previously blocked the deal.
Ukrainian President Volodymyr Zelensky welcomed the new funding, saying it would strengthen the country's economic and financial stability.
Ukraine's economic ministry said it expects the first tranche of funds in March.
There had been fears Hungary's PM would again block the package as he did at a European summit in December.
Viktor Orban, Russian President Vladimir Putin's closest ally in the EU, had said he wanted to force a rethink of the bloc's policy towards Ukraine and questioned the idea of committing funds for Kyiv for the next four years.
The package will help to pay pensions, salaries and other costs over the next four years. It comes as US military aid for Ukraine - the largest provider of military support for Kyiv - is being held up by Congress.
Many European countries also provide military aid to Ukraine.
News of the agreement was announced less than two hours after the summit started, surprising many observers who had expected talks to go on much longer due to the depth of disagreement between Mr Orban and the other EU leaders.
Agreeing a new package of aid for Ukraine requires the unanimous support of all 27 EU member states, meaning until now Hungary had been able to veto a deal.
Diplomatic sources told Reuters that the new deal includes a yearly discussion of the package and the option to review it in two years, "if needed".
Mr Orban had been pushing for a yearly vote on the package, but this could have left the deal exposed to an annual veto threat from Hungary.
"A good day for Europe," Ursula von der Leyen, the president of the European Commission, said on X.
Ukrainian President Volodymyr Zelensky said he was "grateful" to EU leaders, highlighting that the decision was taken by all 27 heads of state in a united display of support for Ukraine, which was invaded by Russia nearly two years ago. Mr Zelensky also said the package would "strengthen the long-term economic and financial stability" of Ukraine.
Ukraine's Foreign Minister Dmytro Kuleba had underlined that it was about Europe investing in its own security. He stressed that Ukraine was resisting Russia for everyone - blocking Mr Putin's attempt to challenge the world order by force.
Polish Prime Minister Donald Tusk, who had been highly critical of what he called Mr Orban's "strange and egotistic game," posted on X: "Viktor Orban could be 'persuaded'... Let's move on."
The EU has been withholding €20bn of funds for Hungary because of concerns about human rights and corruption in the country.
Today's announcement of a new aid package comes after European leaders agreed to open EU membership talks with Ukraine in December - a decision hailed at the time as "a victory" for his country.