WASHINGTON — Congressional negotiators late Monday unveiled a massive $1.1 trillion spending bill that would fund federal agencies through the rest of the fiscal year and end the lingering threat of another government shutdown.

With a deadline fast approaching at midnight Wednesday, House and Senate leaders were preparing a temporary bill to keep the government open through the weekend. That would give lawmakers a few days to review the new measure, which could run to more than 1,000 pages and will stretch into every corner of the federal government.

The spending bill puts flesh on the bones of a bipartisan budget deal struck in December, when Republicans and Democrats agreed to partially repeal sharp spending cuts known as the sequester. As a result, the Pentagon will avoid a roughly $20 billion cut set to hit Wednesday and domestic agencies – which have already absorbed sequester reductions – will receive a bump up in funding of similar size.

Despite those increases, the bill would leave agency budgets tens of billions of dollars lower than President Obama and congressional Democrats had sought. That represents a victory for congressional Republicans, who, after three years of fevered battles over the budget, have succeeded in rolling back agency spending to a level on par with the final years of the George W. Bush administration, before the economic crisis took hold.

Government agencies are “going to be much better off than they were under sequestration, but they’re not going to be back to the same level of effort we had even a couple of years of ago,” said Scott Lilly, a budget analyst at the liberal Center for American Progress. “I think there’s been a degradation of government services that people would be really surprised and upset by if we could get inside these agencies and see what the budget numbers really mean.”

Details of the agreement had been closely held under orders from House Appropriations Committee Chairman Harold Rogers, R-Ky., and Senate Appropriations Committee Chairwoman Barbara Mikulski, D-Md., who met through the weekend to nail down final details.

“We are pleased to have come to a fair, bipartisan agreement on funding the government for 2014,” Mikulski and Rogers said in a joint written statement. “Although our differences were many and our deadline short, we were able to a draft a solid piece of legislation that … keeps the government open, and eliminates the uncertainty and economic instability of stop-gap governing.”

“As with any compromise, not everyone will like everything in this bill,” they said. “But in this divided government a critical bill such as this simply cannot reflect the wants of only one party. We believe this is a good, workable measure that will serve the American people well, and we encourage all our colleagues to support it this week.”

People close to the talks said they had resolved early partisan disagreements over funding for the Affordable Care Act, Obama’s signature legislative achievement, and payments due to the International Monetary Fund, a frequent target of conservatives.

Meanwhile, both sides had agreed to include a provision that would exempt disabled veterans from a modest pension reduction for military retirees enacted last month to help cover the cost of the sequester repeal.

All told, the bill would provide $1.012 trillion to the Pentagon and other federal agencies. An additional $92 billion would be set aside for overseas operations, including military activity in Afghanistan and assistance for the growing flow of refugees fleeing the war in Syria.

The bill also authorizes $6.55 billion for domestic disaster relief.

The legislation also provides new congressional backing for Obama’s strategy of continuing aid to Egypt despite a military coup this summer.