Two months after vowing to never give up the fight against President Obama’s payroll tax proposal, House Republicans decided Friday that they could not afford the battle any more.

Large bipartisan coalitions in both the House and Senate passed a $143 billion economic package that includes a year-long extension of the payroll tax holiday for 160 million workers, just as Obama had requested more than five months ago, and also extends unemployment benefits for millions of others.

On a 293 to 132 vote, the House supported a compromise plan to keep giving workers a small amount of extra cash with each paycheck while also providing a continued cushion for the unemployed, and the Senate followed shortly afterward with a 60 to 36 vote to approve the plan. It now goes to Obama for his signature, giving him a victory on a portion of the massive jobs bill he presented to Congress last fall.

Democrats hailed Friday’s votes as something that would help buoy the economic recovery by putting more money in the hands of consumers, whose spending accounts for roughly two-thirds of the economy. The bill also reduces the amount of time unemployed workers can receive benefits and also assures that doctors do not see a scheduled 27 percent drop in payments from Medicare.

Those measures were accompanied by several efforts to curb the overall impact of the legislation on the federal deficit, including an auction of satellite spectrum to telecommunications firms and steeper contributions for new federal employees to their pension plans.

While the economy has been improving, many economists had been worried that taking the payroll tax cut away could endanger fledgling gains in employment and growth.

Mark Zandi, chief economist at Moody’s Analytics, said failing to extend the payroll tax cut and unemployment benefits would have reduced gross domestic product by 0.4 percent. That would cost about half a million jobs and bump up the unemployment rate by 0.3 percent, he said.

“The recovery is not yet home free,” Zandi wrote in his blog. “A self-sustaining economic expansion is close at hand, but only if policymakers don’t withdraw government support too quickly.”

The new stimulus bill comes three years to the day after Congress passed Obama’s $787 billion American Recovery and Investment Act, his administration’s first attempt to restart the sputtering economy. With Friday’s action, Congress has now spent more than $1.15 trillion since 2009 trying to boost the economy, including the original stimulus bill, the 2010 extension of President George W. Bush’s income tax cuts, the payroll tax cuts over the last three years, first-time homebuyer’s tax credits and unemployment expansions.

Speaker of the House John A. Boehner, while supporting the plan, argued that it was an “economic relief” package that would do little to boost hiring. Boehner (R-Ohio) mocked Obama aides for calling this the last “must-do” item and called for the president to accept some of the GOP’s conservative prescriptions.

“Today is the third anniversary of the president’s failed ‘stimulus’ bill, and it’s yet another reminder that we need to change course and focus on pro-growth economic policies that help small businesses create jobs,” Boehner said.

But Yale economics professor Ray Fair said Friday’s move probably improves Obama’s chances of winning reelection. Fair developed a formula that uses the nation’s GDP to help forecast the victor. In his analysis, the payroll tax cut deal gives Obama just over 50 percent of the vote.

Still, Fair cautioned that the race remains close. Even under a best-case scenario — say, the economy grows at a surprising 4 percent clip — Obama would just eke out a win.

“He has a reasonable shot at it,” Fair said. “That’s about as good as you’re gonna get.”

The compromise votes on Friday were a far cry from where House Republicans were before Christmas, when they proudly invoked Braveheart, the Scottish rebel William Wallace, in a meeting in the Capitol basement and vowed to never approve an extension of the tax holiday without dramatic cuts in spending.

However, as they returned for the new year, Republicans began to realize that Obama and Democrats had continued to portray them as opposing a tax cut to benefit the middle class and feared that a protracted fight again on the payroll holiday would lead to another political debacle. Some GOP veterans said privately that the freshmen had touched the stove — and finally realized it was burning hot.

Now, House Republicans say, the better part of valor is choosing better targets and picking the right fights as they head into their first reelection campaigns.

“Politically, we were getting killed,” said Rep. Tom Reed (R-N.Y.), a freshman from the Buffalo area, recalling the pre-Christmas showdown that nearly let the tax holiday expire. Boehner chose Reed and two other freshmen to serve on the House-Senate panel charged with crafting a compromise before the Feb. 29 deadline, and unlike every big showdown last year, they produced a result with 12 days (instead of 12 hours) to spare.

“We’re learning from our experiences,” Reed said.

The compromise is not likely to spawn a new era of bipartisanship, as both sides have opted for minimalist agendas aimed at laying out the contrast for voters ahead of the fall elections. Anticipating a sharp spike in gas prices, they have crafted an energy bill that would call for more oil and natural gas exploration, and many House Republicans are agitating for a detailed plan to boost small business.

Most of all, Republican lawmakers and strategists said, passing the payroll package was meant to turn the page so that they can try to return the debate to Obama’s economic stewardship amid a three-year stretch of unemployment higher than 8 percent.

Republicans did not have to love this legislation in order to decide they had to pass it. If they had taken the debate right up to, or past, the Feb. 29 deadline, the focus would have been too similar to the December fight.

“We needed to get this policy moved forward. When you’re in the majority, you have to govern,” Rep. Greg Walden (R-Ore.), a senior member of the conference committee, said moments after signing the compromise Thursday afternoon. A day later, 146 Republicans — almost 65 percent of the freshman class — voted for the legislation along with 147 Democrats, as 91 Republicans opposed it.