British Prime Minister David Cameron had held out for the same financial conditions already promised him months ago, overshadowing a summit meant to focus on the continent's youth unemployment problems.
However, in the end, all 27 nations backed the budget deal. EU President Herman Van Rompuy said "it is a quite clear 'yes'," when it came to unanimous backing of the 2014-2020 spending plan.
Beyond the seven-year spending plan, which still needs full parliamentary approval, the EU nations also agreed on the shape of future bank bailouts, injecting a sense of fresh credibility into the efforts of the leaders to control the region's economic problems.
But the budget deal also highlighted deep divisions among European countries over whether to spend or cut their way out of crisis. The UK is seeking reassurances that it won't have to contribute too much at a time of belt-squeezing across the continent.
The multi-annual budget, which includes the first cut to EU spending in its history, determines what the bloc can spend on common infrastructure like railway or road projects, farming subsidies and aid to poor countries. It's separate from national budgets — and much smaller — but a source of difficult and passionate debate.
The decision came after some protracted brinkmanship following the British objections to an outline reached early Thursday. Cameron surprised many by insisting that the EU stick to parts of an earlier agreement reached in February.
Due to a provision on agricultural funding, the country could have lost some of its previously negotiated repayment from the budget, costing it about an annual 200 to 300 million euros, a diplomat from a major EU country said.
The issue left London up against Paris, which would have to pay for the bulk of the shortfall otherwise, the diplomat said. He spoke on condition of anonymity because he wasn't allowed to discuss the closed-door talks publicly.
In the end, Van Rompuy said the British concerns were taken on board, since "actually nothing has changed" on the question of Britain's contribution since the February agreement.
French President Francois Hollande said he signed off on the deal and praised the European Parliament for winning more wiggle room on the budget.
The summit was initially meant to focus on finding ways to get more young people employed, and calmly taking stock of EU efforts to stabilize the world's biggest economic bloc now that its deep debt troubles have subsided.
Crucially, the EU budget also includes money for the employment measures that the bloc's leaders addressed at the two-day summit which finishes Friday afternoon. No budget agreement would mean no money for those projects.
Unemployment is at a record high of 11 per cent for the EU and 12.2 per cent for the 17 member countries that use the euro. It is far worse for the young: Latest figures show almost one in four people aged under 25 in the EU are unemployed. In Greece and Spain, that rate has it hit more than 50 per cent.
After the late-night meetings, Hollande said that 6 billion euros for youth jobs will be speeded up and spent over 2014-2015 instead of over 7 years.
In addition he said that there will be two to three times that amount in "European credits" for employment schemes.
Germany argues that governments should focus on reforms instead of new funding, to get growth going again and create more jobs.
Thursday's deal on the budget came hours after EU finance ministers reached a landmark deal determining that banks' shareholders, creditors and holders of large deposits will have to bear the brunt of future bank failures, so that taxpayers don't have to.
The joint rules on how to restructure or wind down banks are a key step toward establishing a so-called banking union for Europe, aimed at restoring stability after a tumultuous few years that have dragged down the global economy.
Angela Charlton and Sylvain Plazy in Brussels and Geir Moulson in Berlin contributed to this report.
Follow Juergen Baetz on Twitter at http://www.twitter.com/jbaetz
Follow Raf Casert on Twitter at http://www.twitter.com/rcasert