President Barack Obama signed a short-term spending bill on Saturday that averted a government shutdown, formalizing a compromise deal with Republicans that paves the way for more -- and bigger -- deficit-reduction fights to come.

With just over an hour to spare before a midnight deadline, Obama's Democrats and opposition Republicans agreed on Friday to a budget compromise that will cut about $38 billion in spending for the last six months of this fiscal year.

After signing the stopgap spending bill to keep the federal government running until the deal can be formally approved in the coming days, Obama underscored the fact that Washington was open with a surprise visit to the Lincoln Memorial.

I just wanted to say ... that because Congress was able to settle its difference, that's why this place is open today and everybody's able to enjoy their visit, he told cheering tourists from the monument steps.

Friday night's agreement -- after a furious battle over spending and social issues like abortion rights -- averted a shutdown that would have weakened the U.S. economic recovery, forced furloughs for some 800,000 federal employees, delayed paychecks for troops in Afghanistan and Iraq, and closed national parks and monuments.

Obama said the pact involved painful compromises. I would not have made these cuts in better circumstances. But we also prevented this important debate from being overtaken by politics and unrelated disagreements on social issues, he said in his weekly radio address.

DEFICIT WOES

The deal angered some Democrats, who said it unfairly punished working-class Americans as they deal with the lingering effects of a steep economic recession, after Obama agreed to a deal in December that cut taxes for the rich.

These things are bad. I think it's also bad for the American economy, Representative Eliot Engel said on MSNBC.

Republicans lost no time in stressing the deal did not mean they were ready to compromise as the government grapples with a deficit expected to hit $1.4 trillion this year.

Washington has not been telling you the truth about the magnitude of the problems we are facing, Representative Paul Ryan, who has announced a budget plan to save $6 trillion over the next decade, partly by cutting government-run health programs for the poor and elderly, said in the Republicans' Saturday radio address.

The White House made clear it was looking ahead to the next funding fights. Senior administration officials told reporters the deal was a sign the parties could work together on issues like increasing the debt ceiling and cutting the deficit.

(There's a) very important message tonight to the American people and hope for the future that our leaders can come together and ... produce what is the biggest annual spending cut in the history of the country, one said.

The government could hit the current $14.3 trillion limit on its borrowing authority by mid-May and will need Congress to approve another increase in that debt ceiling.

Congress must also approve a budget for the next fiscal year, a fight likely to last well into the 2012 campaign season as Obama seeks a second term.

PUBLIC FRUSTRATION, AMBIVALENCE ON CUTS

Tourists strolling through Washington said they were relieved the government had not closed.

We would not have gone in to check out the Smithsonian museum before coming over here to see the cherry blossoms if everything was closed, said Greg Kohler, 32, of Harrisburg, Pennsylvania, as he walked with his wife and baby under the capital's famed cherry blossom trees.

But Kathy Nelson, 59, a visitor from Huntsville, Alabama, walking near the White House, said a shutdown would have been a needed wake-up call for the country to deal with its debt.

Americans have notoriously mixed feelings about deficits -- they want low taxes, but resist talk of cuts in government healthcare and Social Security pension programs.

As Democrats and Republicans traded blame and a shutdown loomed, the biggest incentive for a deal might have been the risks that failure would have posed for Obama and other politicians of both parties just as the 2012 presidential election campaign gathers steam.

The spending cut was a victory for Republicans who won control of the House of Representatives in November on promises to scale back government. House Speaker John Boehner came under intense pressure from Tea Party movement conservatives inside his party to take an even tougher stance.

Obama and the Democrats were able to beat back a Republican effort to block birth control funding to Planned Parenthood, because the family planning organization also provides abortions -- although not with public money.

The deal did include language banning the use of federal government funds for abortions in Washington, the capital city that comes largely under Congress' jurisdiction.

(Additional reporting by Emily Stephenson and Margaret Chadbourn; Editing by Vicki Allen and Peter Cooney)