Image caption Republican leaders also won their battle this week against a Democratic-backed millionaires' surtax

US lawmakers have agreed to extend a payroll tax break for two months, after Republicans won their fight to attach a provision on a controversial pipeline.

A vote is expected on Saturday on the bill, which would force the Obama administration to make a decision on the oil project early next year.

Compromise was reached after the White House backed away from a threat to veto the pipeline clause.

Meanwhile, a nearly $1tn (£645bn) spending bill has passed the House.

The Senate is expected to clear that legislation on Saturday, averting a shutdown of several federal government agencies.

Passage of these two pieces of legislation would end a year of bitter partisan budget battles on Capitol Hill.

Friday night's deal is not as comprehensive as the one-year payroll tax extension that Democrats had hoped for. The measure is due to expire at the end of the year, affecting the wage packets of 160 million Americans.

Democratic allies split

After initial reluctance, Republicans agreed to back the $120bn plan on condition a deal include a decision on the Keystone XL oil pipeline, which would run from Canada to the US Gulf.

President Barack Obama threatened earlier this month to veto any bill linked to that project, but on Friday the White House softened its tone.

Republicans, who hold sway in the House of Representatives, had warned they would not pass any bill from the Democratic-controlled Senate without the pipeline provision.

Much to conservatives' delight, the row has split two core Democratic blocs - environmentalists, who vehemently oppose Keystone XL; and some union leaders, who say it will bring much-needed jobs.

Image caption Protesters object to the pipeline on environmental grounds but Republicans say it will create jobs

Mr Obama last month delayed a decision on the project until after November 2012's presidential election, prompting Republicans to say he was more concerned with his job than jobs for the American people.

The 1,700-mile (2,700-km) pipeline would run from western Canada through Montana, South Dakota, Nebraska, Kansas and Oklahoma to refineries in Texas.

Republicans and Democrats have been arguing over how to pay for the payroll tax cut.

Earlier this week, Democrats gave up pushing White House demands for a new surtax on millionaires to offset the cost, in the face of stiff Republican objections.

The deal reached on Friday night is expected to include a 60-day deadline for a decision on Keystone XL.

The two-month package would also extend the payroll tax break, unemployment benefits and postpone deep cuts in Medicare fees to doctors.

The US Senate was expected to vote on the package on Saturday, and it could go to the House of Representatives on Monday.

Indiana Republican Richard Lugar crowed that he had helped force President Obama to make a decision on the pipeline.

In a statement, White House communications director Dan Pfeiffer indicated Mr Obama would sign the measure.

But the president would almost certainly deny a permit for the pipeline, unnamed Obama administration officials said hours earlier.

The US state department warned earlier this week that two months would not be enough time to carry out the legally required environmental studies needed to approve the project.

Correspondents say the Obama administration can simply deny approval in early 2012 and go back to its original plan of delaying a final decision, pending the study of an alternative route.