NEW YORK — The “fiscal cliff” compromise, even with all its chaos, controversy and unresolved questions, was enough to ignite the stock market Wednesday, the first trading day of the new year.

The Dow Jones industrial average careened more than 300 points higher, its biggest gain since December 2011. It’s now just 5 percent below its record high close reached in October 2007. The Russell 2000, an index that tracks smaller companies, shot up to the highest close in its history.

The reverie multiplied across the globe, with stock indexes throughout Europe and Asia leaping higher. A leading British index, the FTSE 100, closed above 6,000 for the first time since July 2011.

In the U.S., the rally was extraordinarily broad. For every stock that fell on the New York Stock Exchange, roughly 10 rose. Technology stocks rose the most. U.S. government bond prices fell sharply as investors pulled money out of safe-harbor investments.

Despite the euphoria, many investors remained cautious. The deal that politicians hammered out merely postpones the country’s budget reckoning, they said, rather than averting it.

“Washington negotiations remind me of the Beach Boys song, ‘We’ll have fun, fun, fun ’til her daddy takes the T-Bird away,” Jack Ablin, chief investment officer of BMO Private Bank in Chicago, wrote in a note to clients.

“Nothing got solved,” added T. Doug Dale, chief investment officer for Security Ballew Wealth Management in Jackson, Miss.

According to these and other market watchers, investors were celebrating not because they love the budget deal that was cobbled together, but because they were grateful there was any deal at all.

“Most people think that no deal would have been worse than a bad deal,” said Mark Lehmann, president of JMP Securities in San Francisco.

The deal doesn’t include any significant deficit-cutting agreement, meaning the country still doesn’t have a long-term plan or even an agreement in principle on how to rein in spending.

“There’s definitely another drama coming down the road,” said Lehmann. “That’s the March cliff.”

The political bickering that’s almost certain to persist could have another unwelcome effect: influencing ratings agencies to cut the U.S. government’s credit score. That happened before, when Standard & Poor’s cut its rating on U.S. government debt in August 2011, and the stock market plunged.

Even so, Wednesday’s performance gave no hint of the dark clouds on the horizon.

The Dow enjoyed big gains throughout the day, up by more than 200 points within minutes of the opening bell. It swelled even bigger in the final half hour of trading, and closed up 2.4 percent to 13,412.55.

The Standard & Poor’s 500 jumped 36.23, or 2.5 percent, to 1,462.42. The Nasdaq rose 92.75, or 3.1 percent, to 3,112.26.

The yield on the 10-year Treasury note rose sharply, to 1.84 percent from 1.75 percent. Prices for oil and key metals were up. The price of copper, which can be a gauge of how investors feel about manufacturing, rose 2.3 percent.

Among stocks making big moves, Zipcar shot up 48 percent, rising $3.94 to $12.18, after the company said it would sell itself to Avis. Avis rose 95 cents to $20.77, or 5 percent.

Marriott rose 4 percent, up $1.52 to $38.79, after SunTrust analysts upgraded the stock to “buy.” Headphone maker Skullcandy dropped 13 percent, losing 99 cents to $6.80, after Jefferies analysts downgraded it to “underperform.”