Media playback is unsupported on your device Media caption David Cameron: "The British public can be proud that we've cut the seven-year credit card limit for the EU."

David Cameron has hailed a deal which will see the first ever real-terms cut in the European Union's budget as "good for the UK and good for Europe".

After two days of talks, leaders agreed on a 908bn euros (£768bn) budget limit for 2014 to 2020 - about 3% lower than the current seven-year period.

The prime minister said the public could be "proud" of the deal.

Labour welcomed the news but critics warned the European Parliament could still block the package.

Friday's agreement - which required the backing of all 27 members - represents the first reduction in the EU's multi-annual budget in its history and comes after EU leaders failed to agree a deal in November amid deep divisions over proposed austerity measures.

'Rebate safe'

After hours of negotiations in Brussels, the prime minister said he could "look taxpayers in the eye" and argue he had helped deliver a good deal.

Analysis It is traditional, following EU summits, for all 27 leaders to proclaim a "good deal" for their countries. David Cameron's Brussels press conference certainly didn't break with custom. At home, Conservative MPs have been falling over themselves to say words to the effect of "didn't the boss do well?" Labour is also welcoming the deal, albeit cautiously, having voted before Christmas for a real-terms cut in the budget. But the rule when covering EU politics is watch out for the Euro smoke and Brussels mirrors. Yes, the upper limit for the long-term Brussels budget has fallen. However, to quote the prime minister, "Our contributions were always going to go up, but now they'll be going up by less." And that is before we consider that the European Parliament might reject the deal anyway.

"I think the British public can be proud that we have cut the seven-year credit card limit for the EU for the first time ever," he said.

The deal would see a fall in the share of money given to agriculture, while protecting areas such as research and development, he said, adding that "working with allies it is possible to take real steps towards reform in the European Union".

Mr Cameron said he had "fought off" attempts from all sides to protect the UK's multi-billion pound annual rebate on its contributions, declaring it "safe".

"I battled off every attempt to change it in any way," he told reporters. However, he acknowledged that the UK's yearly contributions would rise - albeit at a slower rate than before - and blamed this on rebate negotiations agreed by the last Labour government in 2005.

The European Commission originally proposed overall spending of 1.03 trillion euros (£870bn) over the period, a 5% increase over the current period which the UK argued was unacceptable at a time most national governments were cutting their own budgets.

MPs from all parties had urged Mr Cameron to push for an unprecedented cut in spending over the seven-year period.

The UK had initially hoped to trim the budget down to about 886bn euros (£749bn) and, as recently as Thursday, Mr Cameron said the proposals did not go far enough and he would not agree a deal unless further cuts were made.

Conservative MEP Martin Callanan said he had hoped for a "smaller, leaner budget" but believed most people would be "reasonably satisfied" with the outcome "given the negative headlines" which preceded the summit.

"Europe's leaders have sent a clear signal to the EU that it must live within its means and this cut is modest compared to some parts of the public sector in EU member states," he said. David Cameron has done a great job at achieving a far better deal than I had expected."

Labour said the outcome had vindicated its surprise backing for a real-terms cut in a debate in Parliament in November.

"It seemed at times that David Cameron was ready to throw in the towel and aim for a freeze, but today's deal proves that a cut was worth voting for in Westminster and worth negotiating for in Brussels," said shadow foreign secretary Douglas Alexander.

"As Labour we called not only for a reduction, but also reform, of the EU budget. The EU had an opportunity to focus the budget on growth and jobs and it will be a matter of deep regret if that was not achieved, but we will continue to scrutinise the details as they emerge."

The UK Independence Party, which wants to leave the EU, said the deal had not addressed the fundamental issue of why the UK should remain in the union

"Clearly a huge victory for David Cameron: looks like he's managed to increase the UK contributions," its leader Nigel Farage said in a Twitter message.

And Martin Schulz, the president of the European Parliament, indicated that MEPs could seek to block the deal while former Belgian prime minister Guy Verhofstadt said the cuts were "unthinkable" while much of Europe was in recession.