Time running short, Republicans and Democrats agreed Tuesday on a $1.1 trillion spending bill to avoid a government shutdown and delay a politically-charged struggle over President Barack Obama's new immigration policy until the new year.

In an unexpected move, lawmakers also agreed on legislation expected to be incorporated into the spending measure that will permit a reduction in benefits to current retirees at economically distressed multiemployer pension plans. Supporters said it was part of an effort to prevent a slow-motion collapse of a system that provides retirement income to millions, but critics objected vehemently.

Officials said final details of the sweeping bill to fund the government would be available later Tuesday, after it was posted online.

"The federal government's going to run out of money in two days. ... We've been trying to work with Republican leaders to avoid a shutdown," Senate Majority Leader Harry Reid of Nevada said at midafternoon as final negotiations dragged on.

Speaker John Boehner said he hoped for a vote on the measure on Thursday, and officials expressed confidence they could overcome opposition from tea party-backed Republicans and avoid a government shutdown.

Senate approval would then be required to send it to Obama — one of the final acts of a two-year Congress far better known for gridlock than for accomplishment.

Not only a two-year Congress, but also a political era was drawing to a close as the lights burned late inside the Capitol on a December night.

For the first time in eight years, Republicans will have a Senate majority in January after a hugely successful midterm election, and newly elected GOP senators-elect participated in closed-door strategy sessions during the day.

Before time runs out on his majority, Reid said he wanted to assure confirmation of nine more of Obama's judicial nominees and approve the appointment of Vivek Murthy as surgeon general.

Also on Congress' must-do list is legislation to renew a series of expiring tax breaks, and a bill to authorize the Pentagon to train and equip Syrian rebels to fight Islamic State forces in the Middle East.

The compromise spending bill will permit virtually the entire government to operate normally through the Sept. 30 end of the fiscal year, with the exception of the Department of Homeland Security.

Funds for that one agency will run out again in late winter. That will give Republicans an opportunity to try to use the expiration as leverage to force Obama to roll back a decision that will suspend the threat of deportation for an estimated 4 million immigrants living in the country illegally.

Not all Republicans agreed with the strategy of postponing a fight over immigration. Some conservative lawmakers demanded a change in the spending measure to deny the use of federal funds to carry out the president's new policy. The leadership ruled otherwise, gambling that even with conservative defections, enough bipartisan support existed for the funding bill to assure its passage.

Earlier in the day, House Republicans removed one obstacle to passage of the spending measure by announcing they would pass legislation separately to renew a requirement for the federal government to assume some of the insurance risk in losses arising from terrorism.

In talks with Sen. Chuck Schumer, D-N.Y., Republicans led by Rep. Jeb Hensarling, R-Texas., agreed to the renewal, but said they wanted to roll back portions of the 2010 Dodd-Frank law that tightened federal regulation on the financial sector.

The stand-alone bill seemed likely to clear the House, but its fate in the Senate was uncertain.

By contrast, disagreement over an emerging proposal relating to multi-employer pension funds was not along party lines.

Officials said the talks between Rep. John Kline, R-Min., and George Miller, D-Calif., were designed to preserve benefits of current and future retirees at lower levels than currently exist, but higher than they would be if their pension funds ran out of money.

"We have a plan here that first and foremost works for the members of the unions, the workers in these companies and it works for the companies," said Miller, retiring at year's end after four decades in Congress.

Not everyone agreed.

The AARP, which claims to represent millions of retirement-age Americans, attacked the agreement as a "secret, last-minute closed door deal between a group of companies, unions and Washington politicians to cut the retirement benefits that have been promised to them."

Also driving the talks was concern over the financial fate of the fund that assures multi-employer pensions at the government's Pension Benefit Guaranty Corp. The agency said in its most recent annual report that the fund's deficit rose to $42.2 billion in the fiscal year ending Sept, 30, up from $8.3 billion the previous year, and that the likelihood of its bankruptcy is 90 percent by 2025.

Agency figures show as many as 1.5 million retirees could be affected by any change in law to permit a reduction. An estimated 400,000 of them receive benefits from the Teamsters' Central States Pension Fund.