BRUSSELS (AP) — Top European Union officials on Thursday hashed out a last-minute deal on a 960 billion euro ($1.3 trillion) budget for the bloc for the next seven years.

The agreement, which includes the first spending cuts in the bloc's history, still requires parliamentary approval. But it ends months of infighting over the package and hands the recession-hit 27-nation area a proper budget to finance everything from infrastructure and farming subsidies to development aid and employment measures.

European Commission President Jose Manuel Barroso announced the agreement Thursday after talks with lawmakers and officials representing the EU member states. European Parliament President Martin Schulz called the deal "acceptable" and said he's "optimistic" that a majority of lawmakers will back it at a vote next week.

The deal came only a few hours before the 27 nations' heads of state and government were to hold a summit in Brussels to promote, among other initiatives, policies to fight the bloc's rampant youth unemployment. Without a multi-annual budget in place, these employment schemes could not have been implemented.

The 2014-2020 budget includes the bloc's first ever spending cuts, as many of the bloc's countries are in recession and struggling to reduce their own national debt.

"This is a good deal for Europe, this is a good deal for European citizens, this is a good deal for the European economy," Barroso said. "This is the growth fund for Europe," he added, noting that it allows for more money to be spent quicker on investment and other projects boosting employment.

Separate from national spending — and much smaller than EU national budgets — the EU budget is designed in part to balance out the economic development of its members by injecting funding into poorer countries. The EU has funded thousands of infrastructure and capital projects over the years, from the installation of broadband networks to the upgrade of road networks.

The EU countries have been trying since last fall to cobble the budget together. Some countries wanted to increase or maintain spending levels while others firmly insisted it made no sense to increase the budget while individual governments were imposing tough austerity policies at home. In February, the leaders agreed on a rigid 960 billion euro budget framework.

The European Parliament, however, rejected that compromise. It asked for more flexibility, a greater say in the way the budget allocates spending and the ability to renegotiate the overall spending level once the economy picked up and the EU took over more responsibilities from member states. Finally, lawmakers asked for money to be spent to boost employment.

"The agreement is not ideal but there are decisive improvements," said the leader of Parliament's center-left minority caucus, Hannes Swoboda. "The European Parliament's key demands — especially on growth and the fight against youth unemployment — have been met," he added.

Ireland, which had been hoping a budget deal would crown its stint at the rotating six-month presidency of the EU that ends Sunday, cheered the agreement.

The deal on the multi-annual budget has been added to the EU summit's agenda for approval, before sending it to Parliament for a vote.

"I hope we will reach a decision today," said German Chancellor Angela Merkel as she headed into the EU summit. "That would be good news for our capacity to plan many measures in Europe," she added.

If the EU were to fail reaching an agreement on the seven-year deal before the end of the year, the bloc would have to revert to annual budgets which would make long-term planning difficult and make some spending impossible for programs stretching over several years.