Obama quickly signed the legislation, declaring it was "some good news just in the nick of time for the holidays." But he added that serious and difficult work lay ahead for Congress and the administration after the break for Christmas and New Year's.
Both the Senate and the House approved the two-month measure in seconds with no debate. This came just days after House Republicans insisted that negotiating on a full-year bill was the only way to prevent an immediate tax increase on Jan. 1.
The measure, which was passed despite some lingering grumbling from tea party Republicans, buys time for talks early 2012 on how to finance the year-long extensions.
It will keep in place a 2-percentage point cut in the payroll tax - a salary boost of about $20 a week for an average worker making $50,000 a year - and prevent almost 2 million unemployed people from losing jobless benefits amounting to about $300 a week on average.
Passage of the tax bill in the House ended an end-of-year GOP confrontation with President Barack Obama and Senate Democrats that had threatened to hit 160 million workers with a tax increase on Jan. 1.
But it backfired badly. Even Republican Senate leader Mitch McConnell and the Wall Street Journal editorial board urged Speaker John Boehner and other House Republicans to act quickly and keep the tax cut in effect.
These developments were a clear win for Obama. The payroll tax cut was at the crux of his three-month, campaign-style drive for jobs legislation that seems to have contributed to an uptick in his poll numbers - and taken a toll on those of congressional Republicans.
Obama, Republicans and congressional Democrats all said they preferred a one-year extension but the politics of achieving the goal, particularly the spending cuts and new fees required to pay for it, eluded them. All pledged to start working on that in January.
The Associated Press contributed to this report.