European leaders have agreed a cut in the EU budget after German chancellor Angela Merkel sided with David Cameron's demand that Brussels tighten its belt, however the European Parliament may veto the deal.
When the 27-way summit finally got under way, the opening bid presented to the leaders for agreement amounted to a budget proposal of 913 billion euros (£778 billion) for 2014-2020.
On Friday afternoon, after all night negotiations, leaders finally agreed 908bn euro budget - a cut of five billion euros.
Speaking after an agreement was reached, the prime minister said he had done a "good deal" for Britain and had worked with other European leaders to secure the cut.
"We wanted to cut this credit card," he said. "On any fair way of looking at it, that is exactly what we have done."
"We worked hard with the Dutch, Danes, Swedes and Angela [Merkel] to make sure Europe's taxpayers got a good deal," he said.
It has also been reported that Merkel sided with Cameron against French President Francois Hollande on the budget. "We had some debates and discussions," the prime minister acknowledged.
European Council president Herman Van Rompuy announced the deal had been done with a Tweet.
The settlement will allow Cameron to claim that his basic demands that Europe at least nods towards the austerity being endured by national treasuries have been met.
In October Labour joined with eurosceptic Tories in a Commons vote to demand the prime minister argue for a real-terms cut in the EU's long-term budget during the negotiations.
Tory Douglas Carswell, one of the more eurosceptic MPs and not a huge fan of the prime minister, welcomed the deal by declaring "three hearty cheers" to Cameron.
"Under pressure from the taxpayer, MPs instructed ministers not to hand over extra amounts of money. And ministers appear to have responded by securing a deal that does precisely that," he said.
And Rochester and Strood MP Mark Reckless, who led the rebellion in the Commons over the budget, offered his congratulations in a video message posted on You Tube.
"His [Cameron's] diplomats, his permanent representative in Brussels, the Liberal Democrats all said the best we could hope for was a freeze," he said.
"By passing my amendment, Parliament voted to strengthen that negotiating mandate and demand a cut. With Parliament behind him, the Prime Minister has delivered at the EU council today."
However even though the overall budget for the next seven years may come down, the UK's contribution could actually increase.
Ukip leader Nigel Farage dismissed the deal: "Shaving a few pence off our daily contribution is inconsequential; the question now is why are we paying anything at all?"
Even if the terms are endorsed at the summit, the deal must run the gauntlet of the European Parliament, which now looks likely to call a secret ballot.
Parliament President Martin Schulz confirmed last night that he intended deploying the rarely used procedure.
If so, by allowing MEPs to vote anonymously, the move will effectively stop EU leaders galvanising their own members of the Parliament to support the budget deal.
European Parliament officials said it looked certain the bid to call a secret ballot would be backed, as required, by one fifth of MEPs, with a secret vote held within three months.
Jean Lambert MEP: Why Cuts in the EU Budget Are Just Another Austerity Measure That Will Hit the Poorest Hardest
However, Tory MEP Martin Callanan condemned the idea as a "highly cynical and unaccountable act" on one of the Parliament's most important ever votes.
Callanan, leader of the European Conservatives and Reformists group, said others had to be able to see how their representatives voted on their behalf.
"If MEPs want to reject an agreement made by their own prime ministers then they should have the courage of their convictions and not try to cower behind a procedural technicality.
"The European Parliament must be accountable to its voters which it cannot be if MEPs connive to hide their voting record on an issue that they should be judged on at the ballot box. This is not some small vote; it is one of the most important decisions of the entire legislature."
He added: "This kind of behaviour brings the EU and politicians into disrepute. My group will argue for a roll call vote on any deal reached so that all MEPs can stand on the doorsteps in their constituencies and explain why they cannot support their prime minister."