WASHINGTON — A last-minute budget deal forged with tough bargaining averted an embarrassing U.S. government shutdown, cut billions in spending and provided the first major test of the divided government that voters ushered in five months ago.
Working late into Friday night, congressional and White House negotiators finally agreed on a plan to pay for government operations through the end of September while trimming $38.5 billion in spending.
Lawmakers then approved a measure to keep the government running for a few more days while the details of the new spending plan are written into legislation.
Actual approval of the deal is expected in the middle of next week.
President Barack Obama on Saturday signed the short-term spending bill to pay for federal operations through Friday. The signing took place in private, and the White House announced it with a press release.
"Americans of different beliefs came together again," Obama, a Democrat, said earlier from the White House.
Amid the biggest clash yet between Democrats and the resurgent Republicans who control the House of Representatives, Obama had warned that a shutdown would damage the economy's recovery by putting an estimated 800,000 government employees out of work.
The political stakes of a shutdown were huge ahead of next year's presidential and congressional elections. During the last government shutdown in Bill Clinton's presidency, Republicans got most of the blame — but there was no assurance that would have happened again.
Since taking control of the House in January, Republicans have vowed to slash what they described as out-of-control spending and curb the federal deficit. Democrats have accused Republicans of wanting to cut vital government services and pushing a social agenda.
The agreement was negotiated by Obama, Republican House Speaker John Boehner and Democratic Senate Majority Leader Harry Reid.
The administration was poised to shutter federal services, from national parks to tax-season help centers, and to send furlough notices to hundreds of thousands of federal workers.
All sides insisted they wanted to avoid that outcome.
Shortly after midnight, White House budget director Jacob Lew issued a memo instructing departments and agencies to continue normal operations.
Boehner said the deal came after "a lot of discussion and a long fight." He won an ovation from his rank and file, including the conservative tea party adherents who made inroads last November by calling for spending cuts.
Reid declared the deal "historic."
The deal marked the end of a three-way clash of wills. It also set the tone for coming confrontations over raising the government's borrowing limit, the spending plan for the budget year that begins Oct. 1 and long-term deficit reduction.
The deal came together after six grueling weeks as negotiators virtually dared each other to shut down the government.
Boehner faced pressure from his Republican colleagues to stick as closely possible to the $61 billion in cuts and the conservative policy positions that the House had passed.
At one point, Democrats announced negotiators had locked into a spending cut figure — $33 billion. Boehner pushed back and said there was no deal. During a meeting at the White House this past week, Boehner said he wanted $40 billion. The final number fell just short of that.
More battles are expected.
House Republicans intend to pass a 2012 budget in the coming week that calls for sweeping changes in the federal health programs for the elderly and needy families, and even deeper cuts in domestic programs to gain control over soaring deficits.
In the Republican radio address, House Budget Committee Chairman Paul Ryan warned of a coming crisis.
"Unless we act soon, government spending on health and retirement programs will crowd out spending on everything else, including national security. It will literally take every cent of every federal tax dollar just to pay for these programs," Ryan said Saturday.
That debate could come soon.
The Treasury has told Congress it must vote to raise the debt limit by summer. Republicans hope to use this issue to force Obama to accept long-term deficit-reduction measures.
Associated Press writers David Espo, Andrew Taylor, Erica Werner, Julie Pace and Ben Feller contributed to this story.
Obama weekly address: www.whitehouse.gov
Republican address: www.youtube.com/republicanconference