The US president was speaking after the House of Representatives passed a Senate-backed bill by 257 votes to 167.
It raises taxes for the wealthy and delays spending cuts for two months.
There had been intense pressure for the vote to be passed before financial markets reopened on Wednesday.
In Tuesday night’s house vote, 172 Democrats and 85 Republicans voted in favour of the bill.
A majority of Republicans, 151 in total, voted no, along with 16 Democrats.
The bill had been passed in the Senate less than 24 hours earlier by 89 votes to eight after lengthy talks between Vice-President Joe Biden and Senate Republicans.
Asian markets have responded positively to the move, with Hong Kong’s Hang Seng index up 2.1% on Wednesday morning, while South Korea’s Kospi added 1.7% and Australia’s ASX 200 rose 1.2%.
Speaking before returning to Hawaii for his interrupted Christmas holiday, Mr Obama said that in signing the law he was fulfilling a campaign pledge.
“I will sign a law that raises taxes on the wealthiest 2% of Americans… while preventing a middle-class tax hike,” he told a White House press conference.
The US deficit was still too high, he said: While open to compromise on budgetary issues, he would not offer Congress spending cuts in return for lifting the government’s borrowing limit, known as the debt ceiling.
“There is a path forward, if we focus not on politics, but on what’s right for the country,” added Mr Obama.
The “fiscal cliff” measures – cutting spending and increasing taxes dramatically – came into effect automatically at midnight on Monday when George W Bush-era tax cuts expired.
The 1 January deadline triggered tax increases of about $536bn and spending cuts of $109bn from domestic and military programmes.
Economists had warned that if the full effects of the fiscal cliff were allowed to take hold, the resulting reduction in consumer spending could have sparked a new recession.
The compromise deal extends the tax cuts for Americans earning under $400,000 (£246,000) – up from the $250,000 level Democrats had originally sought.
In addition to the income tax rates and spending cuts, the package includes:
- Rises in inheritance taxes from 35% to 40% after the first $5m for an individual and $10m for a couple
- Rises in capital taxes – affecting some investment income – of up to 20%, but less than the 39.6% that would prevail without a deal
- One-year extension for unemployment benefits, affecting two million people
- Five-year extension for tax credits that help poorer and middle-class families