Traders work on the floor of the New York Stock Exchange on Jan. 2, 2013, as stocks rally. / Spencer Platt, Getty Images

by Matt Krantz, USA TODAY

by Matt Krantz, USA TODAY

Stocks shot higher Wednesday on the first trading day of the new year as investors expressed relief lawmakers finally found a way to avert the economy from falling off the fiscal cliff.

The Dow Jones industrial average rocketed more than 300 points higher and the Standard & Poor's 500 index gained more than 2.5% to 1,462, getting 2013 started off following a better-than-average 13.4% gain in 2012.

It was the best first-day percentage gain by the S&P 500 since the 3.2% opening in 2009. It's also the first time ever that the S&P 500 has gained the first day of the year for five consecutive years.

The Dow's 308-point, 2.4%, gain to 13,412.55 was its best one-day gain since Dec. 20, 2011.

"We can all breathe a sigh of relief that the country is not unnecessarily lurching into recession," says David Joy, strategist at Ameriprise Financial in a letter to clients.

All three major U.S. stock market indexes are now pushing toward setting new bull market highs. The S&P 500 is the closest, falling shy of its Sept. 14, 2012 bull market high by just 0.2%. The Dow is 1.5% below its bull market high.

Stocks around the world also leapt higher. Major indexes in Britain, France and Germany rose more than 2%. Markets in Greece and Spain were up more than 3%. Stocks in Asia also zoomed higher.

Some investors cautioned that the euphoria can't last long. Analysts are torn on what the budget deal means for the economy, and investors remain torn on how the deal will affect stocks long term.

Brian Belski, strategist at BMO Capital Markets, remains bullish and is calling for a 10% return this year.

Russ Koesterich, strategist at BlackRock, is less optimistic. "Investors should be prepared for a bumpier ride in 2013, at least until Washington produces a more definitive, longer-term agreement," he wrote in a note to clients.

The market's big escalation Wednesday, they said, was driven not so much because investors love the budget deal that Republicans and Democrats hammered out, but because they're 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. He called the current package "not too Draconian."

The bill passed Tuesday night avoids the "cliff," but it only postpones many of the budget issues haunting the U.S.

The deal doesn't include any significant deficit-cutting agreement, meaning the country still doesn't have a long-term game plan for how to rein in government spending. Big cuts to defense and domestic programs, which were slated to kick in with the new year, were delayed for two months and are still overhang the market. And the U.S. is still set to bump up against its borrowing limit, or "debt ceiling," in about two months.

"There's definitely another drama coming down the road," said Lehmann. "That's the March cliff."

Others worry that more political bickering could cause the U.S. to get its debt rating downgraded by the ratings agencies. The stock market plunged in August 2011 after Standard & Poor's rating agency cut the U.S. government's credit rating a notch.

But Wednesday's market performance gave little hint of any dark clouds on the horizon.

The yield on the 10-year Treasury note rose sharply, to 1.84% from 1.75%, as investors dumped safe harbor investments like U.S. government bonds and plowed money into stocks. Prices for oil and key metals, including gold, copper and platinum, were up.

Among stocks making big moves, Zipcar shot up 48%, or nearly $4, to $12.18 after the company said it had agreed to sell itself to Avis. Avis rose $1.02 to $20.84, about 5%.

Zipcar has a business model that's popular with drivers, allowing them to rent cars for just a few hours at a time. The company has struggled to win over investors, however, and its stock plunged nearly 39% in 2012. Avis rose 84% in the same period.