U.S. lawmakers struggled on Friday to agree to a deal on payroll tax relief for 160 million Americans after a roller-coaster week of brinkmanship again laid bare the  partisan divide that has gridlocked the U.S. Congress all year.

The talks on extending the $120 billion payroll tax cut for another year followed a separate deal reached by bickering lawmakers on Thursday night to keep the U.S. government running through September 2012.

With the government just hours away from running out of money for a wide range of programs, the House of Representatives approved on Friday a nearly $1 trillion spending bill. The Senate most likely will pass it on Saturday and send it to President Barack Obama to sign into law.

The House vote approving the spending bill was 296-121, with about a third of the chamber's 242 Republicans voting no.

After a week of partisan wrangling, a driving force behind the 11th-hour spending deal appeared to be fears among party leaders of a voter backlash in the 2012 presidential and congressional elections. Congress' approval ratings are already at record lows.

Republican and Democratic aides were still negotiating on Friday over how to pay for the payroll tax cut, which the White House and some economists warn must be renewed or risk damaging the still-tepid economic growth.

House of Representatives Speaker John Boehner, the top U.S. Republican, swatted down a Democratic proposal for just a two-month extension to allow more time for negotiations.

Boehner said that if the Senate passed the stopgap measure, the Republican-led House would insert a provision to accelerate a decision on the proposed Keystone XL pipeline that would transport oil from Canada to refineries on the U.S. Gulf Coast.

Obama has delayed a decision on the pipeline until 2013 and called for further environmental studies. Environmental groups, a core constituency, strongly oppose the project. Obama has already threatened to veto any bill that links Keystone to the payroll tax cut.

"If that bill comes over to us, we will make changes to it, and I will guarantee you that the Keystone pipeline will be in there when it goes back to the United States Senate," Boehner told reporters on Friday.