Image copyright Getty Images Image caption The US government was partially shut down for 16 days in October when Congress failed to agree a budget

The US Congress has reached an agreement on a trillion-dollar spending bill that would fund operations through September, staving off the spectre of another government shutdown.

Senate and House of Representatives negotiators agreed the deal on Monday night, as Wednesday's deadline loomed.

The $1.1tn (£670bn) spending bill is expected to leave both conservatives and liberals dissatisfied.

But leading legislators have hailed the fact an agreement was reached at all.

"This agreement shows the American people that we can compromise, and that we can govern. It puts an end to shutdown, slowdown, slamdown politics," Democratic Senator Barbara Mikulski, chairwoman of the Senate appropriations committee, wrote in a statement on Monday.

'Obamacare lives'

The legislation will continue the downward trend in federal spending to put our nation on a sustainable fiscal path Hal Rogers, Chairman of the House appropriations committee

On Tuesday, President Barack Obama praised the deal and urged Congress to pass it into law as quickly as possible.

"I was very pleased to see the House and the Senate agree to a budget and to put forward a bill that will fund our government at levels that allow us to take some important steps to provide the services and the help that Americans need and American families need in order to get ahead in this economy," he said.

The deal heads off a nearly $20bn automatic spending cut from hitting the Pentagon on Wednesday.

It also avoids another government shutdown on par with the 16-day shutdown in October, which occurred after Republicans refused to pass a bill funding the government that did not strip funding for Mr Obama's healthcare law, before eventually yielding.

Known as the omnibus appropriations bill, the legislation fleshes out the terms of a spending framework agreed in December. That law set overall spending levels, while the new bill specifically authorises US government agencies to spend the money.

The spending bill will not include additional funds for the Affordable Care Act, President Barack Obama's signature healthcare overhaul, but neither does it strip funding from the law, a goal of the Republican Party.

"Obamacare lives another day," Ms Mikulski said.

The bill sets the Pentagon's budget at $572bn, including $85.2bn to fund the war in Afghanistan. But it cuts assistance programmes for Afghanistan by 50%, to $1.12bn.

It reduces the Internal Revenue Service budget by $503m, and includes no funding for Mr Obama's preschool development grants programme or national high-speed rail projects.

But it restores funding previously cut from the Head Start early childhood education programme, and from medical research and job training. It also gives federal workers a 1% pay rise.

Republicans won provisions gutting environmentally friendly light bulb requirements, and a provision to ban the transfer of prisoners from Guantanamo Bay on to US soil.

The US Postal Service will also be saved from cutting Saturday mail delivery, as had previously been considered.

"The bill reflects careful decisions to realign the nation's funding priorities and target precious tax dollars to important programs where they are needed the most," House appropriations committee chairman Hal Rogers said on Monday.

"At the same time, the legislation will continue the downward trend in federal spending to put our nation on a sustainable fiscal path."