Connect to share and comment
The agreement will cut spending for the first time since the EU was created in 1957.
The news was announced by European Council President Herman van Rompuy, who said it was "worth waiting for" following all-night talks here.
The deal for the $1.3 trillion budget for spending between 2014 and 2020 shaves more than $45 billion from the union's expenses.
That's seen as a victory for British Prime Minister David Cameron, who had been pushing for thrift in Europe.
Leaders competed to claim victory, although those seeking the big cuts were happiest.
"The British public can be proud that we have cut the seven year credit card limit of the European Union for the first time," Cameron told a news conference.
"It is a good compromise, given the circumstances," French President Francois Hollande acknowledged in the room next door.
The battle to carve up the budget was always going to be an every-prime-minister-for-himself affair.
None of the 27 leaders was prepared to return home saying he'd given up a cherished national slice of the EU pie.
"This is Europe at its worst," said Hans Martens, chief executive of the European Policy Center think tank as the talks drew to a close. "They are all looking after their own interests and nobody's thinking of the common good."
As they wrangled through the night, the northern penny pinchers led by Britain's David Cameron demanded and secured their cut. Nevertheless, the UK's contribution is expected to rise under a previous deal to help fund the EU's eastward enlargement negotiated by former Prime Minister Tony Blair.
Poorer countries to the south and east, from Poland to Portugal, fought to maintain funding for public works projects.
Hollande had to ensure that the shrinking pot was filled with sufficient largesse for France's sacred cow — EU subsidies for the combative farm lobby.
The biggest casualties were perhaps the issues the EU most needs to spend money on: research to give Europe's struggling economy a more competitive edge and investment on trans-national energy and communications networks.
A flagship economic modernization scheme called "Connecting Europe" designed to modernize long-distance transport, energy and digital communications lines saw its budget slashed from $67 billion to $39 billion.
After more than 24 hours of non-stop haggling, leaders may be thinking a bad agreement is better than no agreement at all, however, except that they still have to get the diminished budget voted through the European Parliament and that looks like a tough task.
The deal must also be approved by the European Parliament, which may take time because requires the approval of every member state.
"This agreement will not strengthen the competitiveness of the European economy but weaken it. It is not in the prime interest of our European citizens," said a joint statement from the leaders of the four largest groups in the EU's assembly. "The European Parliament cannot accept today's deal."
However, at least somebody saw the funny side of it.