Belgian political parties negotiating a coalition agreement reached a deal on the 2012 budget on Saturday, clearing the last major obstacle to the formation of a new government more than 18 months after elections were held.

The deal came hours after ratings agency Standard & Poor's downgraded Belgium's credit to AA from AA+, piling pressure on the country to act.

S&P said difficulties in Belgium's banking system and the government's inability to respond to economic pressures had contributed to the downgrade.

After the downgrade late on Friday, Belgium's caretaker prime minister, Yves Leterme, urged budget negotiators to reach a deal before markets open on Monday, fearing that the country's borrowing costs could be pushed beyond sustainable levels.

The formateur and the negotiators reached a major milestone in the formation of the Government, the negotiators said in a statement, referring to the Belgian term for the person responsible for negotiating the coalition, Elio di Rupo, who is likely to be the next prime minister.

They have developed budgets for 2012, 2013 and 2014 and reached an agreement on long-term structural reforms in employment and pensions, the statement said.

The negotiators said that under the deal, Belgium would reduce its budget deficit to 2.8 percent of gross domestic product in 2012 from 3.6 percent expected this year and balance its books in 2015.

The long-term structural reforms will help to preserve our social model, to face the challenge of extending the life span and boost our economy, they said in the statement.

Belgium's King Albert welcomed the budget deal and called on Di Rupo to take rapid steps to form a new cabinet.

The king is pleased that agreement has been reached. Accordingly, the king instructed the formateur to form a government as quickly as possible, the Royal Palace said.

Elio di Rupo and the party negotiators are to hold a press conference on Sunday afternoon.

Analysts said the intervention by S&P was decisive in getting the six parties in the talks to reach a deal, overcoming deep-seated linguistic and political divisions. S&P's decision looked set to push Belgian's borrowing costs even higher than the 5.89 percent it currently has to offer on 10-year bonds.

Of course that means it's possible for Belgium to see an interest rate higher than before, and that was a stimulus for finishing the negotiations, said Pascal Delwit of the Universite Libre de Bruxelles.

The budget could be voted on by Belgium's parliament by January, he said. It will be discussed next month in order be voted by January 1.

Degroof Bank chief economist Etienne de Callatay said the deal now cleared the way for Belgium to form a government.

Now we have done 99 percent of the work, he said, adding that there will be a government before the end of the year.

However Belgium's downgrade will still weigh on a bond auction planned for Monday, he said. The interest rates will rise on Monday despite the political agreement ... confidence goes faster than it returns, he said.

ENDLESS TALKS

Belgium has set a modern-day record for being without a formal government. It has been nearly 19 months since elections were held last June.

The country's squabbling politicians had to find 11.3 billion euros ($15.09 billion) of savings so that Belgium can cut its deficit to below 2.8 percent of gross domestic product (GDP) next year, in line with EU rules.

The budget wrangling and a wider loss of confidence in European sovereign debt have pushed up Belgium's borrowing costs sharply. At the end of September, the yield on benchmark 10-year government bonds was under 3.9 percent. On Friday, it was up to 5.9 percent.

Belgium's downgrade followed another rough week in European sovereign debt markets. Italy paid a record 6.5 percent to borrow money over six months on Friday, piling pressure on Rome's new emergency government.

At the same time Belgium is trying to deal with the fallout from the near collapse of one of its biggest banks, Dexia. The Belgian, French and Luxembourg governments are providing Dexia with 90 billion euros of guarantees to try to help it weather the financial crisis and funding problems.

Belgium is responsible for slightly over 60 percent of those guarantees. If it was forced to pay out, it would put even greater pressure on the government's budget numbers.

(Additional reporting by Ben Deighton; Editing by Louise Ireland and David Cowell)