WASHINGTON (AP) - Senate leaders agreed on compromise legislation to extend Social Security payroll tax cuts and jobless benefits for two months while requiring President Barack Obama to accept Republican demands for a swift decision on the fate of an oil pipeline that promises thousands of jobs.
A vote is expected Saturday on the measure, the last in a highly contentious year of divided government.
Any deal would also require House passage before it could reach Obama's desk.
A senior administration official said on condition of anonymity the president would sign the measure but almost certainly refuse to grant a permit for the oil pipeline project. The official was not authorized to speak publicly about the deal.
Racing to adjourn for the year, lawmakers moved quickly to clear separate legislation avoiding a partial government shutdown threatened for midnight.
There was no immediate response to the compromise from the White House, which a few hours earlier had backed away from Obama's threat to veto any bill that linked the payroll tax cut extension with a Republican demand for a speedy decision on the 1,700-mile Keystone XL oil pipeline proposed from Canada to Texas.
Republican senators leaving a closed-door meeting put the price tag of the two-month package at between $30 billion and $40 billion said the cost would be covered through a fee on mortgages backed by Fannie Mae and Freddie Mac.
The legislation would also provide a 60-day reprieve from a scheduled 27 percent cut in the fees paid to doctors who treat Medicare patients.
Several officials said it would require a decision within 60 days on the pipeline, with the president required to authorize construction unless he determined that would not be in the national interest.
Obama recently announced he was postponing a decision until after the 2012 elections on the much-studied proposal. Environmentalists oppose the project, but several unions support it, putting the president in the uncomfortable position of having to choose between customary political allies.
Senators in both parties hastened to claim credit.
Sen. Richard Lugar, R-Ind., issued a statement that said the compromise included legislation he authored "that forces President Obama to make a decision" on the pipeline.
Sen. Max Baucus, D-Mont., said he had "brokered a final deal by bringing lawmakers from both parties together to support jobs."
Officials said in private talks, the two sides had hoped to reach agreement on the full one-year extension of payroll tax cuts and jobless benefits Obama had made the centerpiece of the jobs program he submitted to Congress last fall.
Those efforts failed when the two sides could not agree on enough offsetting cuts to make sure the deficit wouldn't rise.
"We'll be back discussing the same issues in a couple of months, but from our point of view, we think the keystone pipeline is a very important job-creating measure in the private sector that doesn't cost the government a penny," said Sen. Mitch McConnell of Kentucky, the Republican leader.
There was no immediate reaction from House Speaker John Boehner. Neither he nor his aides participated in the negotiations, although McConnell said he was optimistic about the measure's chances for final approval.
Hours earlier, McConnell challenged Obama to give ground.
"Let's not just pass a bill that helps people on the benefits side, let's also include something that actually helps the private sector create the jobs Americans need for the long term," he said.
In a political jab, he added, "Here's an opportunity for the president to say he's not going to let a few radical environmentalists stand in the way of a project that would create thousands of jobs and make America more secure at the same time."
Obama said on Dec. 7 that "any effort to try to tie Keystone to the payroll tax cut I will reject. So everybody should be on notice."
More recently, a veto threat issued Tuesday against the House-passed version of the bill cited the introduction of "ideological issues into what should be a simple debate about cutting taxes for the middle class." Senior administration officials later told reporters that was a reference to the pipeline.
The State Department, in an analysis released this summer, said the project would create up to 6,000 jobs during construction, while developer TransCanada put the total at 20,000 in direct employment.
The 1,700-mile pipeline would carry oil from western Canada to Texas Gulf Coast refineries, passing through Montana, South Dakota, Nebraska, Kansas and Oklahoma.
The spending bill would lock in cuts that conservative Republicans won from the White House and Democrats earlier in the year.
Republicans also won their fight to block new federal regulations for light bulb energy efficiency, coal dust in mines and clean water permits for construction of timber roads.
The White House turned back GOP attempts to block limits on greenhouse gases, mountaintop removal mining and hazardous emissions from utility plants, industrial boilers and cement kilns.
After a last-minute veto threat, Republicans abandoned attempts to block an administration policy to ease restrictions on visits to Cuba and on the money sent to relatives on the communist island nation from family members living in the United States.
Additionally, the legislation bars military and economic aid to Pakistan until the administration certifies Islamabad is cooperating on counterterrorism, including taking steps to prevent such militant groups as the Haqqani network from operating in the country.
The provision stems from concerns that the Pakistani government harbors terrorists and from assertions some government officials knew Osama bin Laden had established residence deep inside the country. Bin Laden was killed in May by U.S. commandos who raided his fortified compound in Abattabod.