Global equity markets staged a massive relief rally on Monday after officials agreed to a $1 trillion emergency rescue package to halt a festering sovereign debt crisis in Europe from engulfing the rest of the world.

The euro rose broadly after the European Union and the International Monetary Fund carved out an emergency rescue package of up to 750 billion euros ($1 trillion) to keep Greece's debt crisis from spreading through the euro zone.

The price of oil and other commodities surged as the rescue deal stoked investors' appetite for riskier assets, and safe-havens like bonds tumbled as the aversion to risk eased.

The equities rally began in Asia after EU and IMF officials announced the deal and then caught fire around the world as other markets opened. European shares rose at their fastest clip in more than 17 months, while the S&P 500 posted its biggest percentage and point gain at the open since at least the late 1960s.

U.S. stocks finished the day with the best one-day gain in more than a year.

The European aid package was the biggest government rescue since the Group of 20 leaders moved to stabilize markets after the Lehman Brothers collapse in September 2008 led the U.S. recession to spread worldwide and sent markets plunging.

This could've been another situation like when Bear Stearns and Lehman Brothers failed, but the rescue plan shows how serious Europe is about preventing that, said Alan Lancz, president of Alan B. Lancz & Associates, an investment advisory firm in Toledo, Ohio.

Banks ranked among the top beneficiaries as the huge bailout reduced fears of a possible default. The STOXX Europe 600 banking index <.SX7P> jumped 14 percent after a drop last week by the same magnitude.

On Wall Street, the S&P Financial index <.GSPF> climbed 5.6 percent and was the top gainer among S&P sectors.

A global measure of world equity performance gained almost 5 percent, while markets in Italy, Spain and Portugal climbed more than 10 percent.

The Dow Jones industrial average <.DJI> closed up 404.71 points, or 3.90 percent, at 10,785.14. The Standard & Poor's 500 Index <.SPX> rose 48.85 points, or 4.40 percent, at 1,159.73. The Nasdaq Composite Index <.IXIC> climbed 109.03 points, or 4.81 percent, at 2,374.67.

But questions about how the plan will work knocked the euro off its high for the day near $1.31, after having rebounded from a 14-month low near $1.25 hit last week when markets feared the debt crisis in Greece would spread to other euro zone countries.

By late afternoon the euro was below $1.28, not far from its level late Friday, before the bailout was announced.

We're still not sure how some of the funding will work, and I don't think this addresses the core problem: Greece's debt trajectory is still by any measure unsustainable, said Win Thin, senior currency strategist at Brown Brothers Harriman in New York.

The rescue package was on the scale of the $700 billion Troubled Asset Relief Program launched by the United States to fend off the worst financial crisis since the Great Depression.

In addition, there were measures by central banks to address funding strains and a European Central Bank plan to buy the region's government bonds.

A number of European central banks said they had already started. [nLDE649051]

MSCI's all-country world equity index <.MIWD00000PUS> rose 4.8 percent, while its emerging market index <.MSCIEF> gained 4.4 percent.

The pan-European FTSEurofirst 300 <.FTEU3> closed up 7.4 percent at 1,038.91, the biggest one-day percentage gain since November 2008.

U.S. crude for June delivery settled up $1.69, or 2.25 percent, at $76.80 a barrel.

The euro was up 1.07 percent at $1.2792.

The dollar was down against a basket of major currencies, with the U.S. Dollar Index <.DXY> off 0.30 percent at 84.198.

Against the yen, the dollar was up 1.75 percent at 93.16.

Gold slipped less than 1 percent, holding relatively firm, as analysts said the bailout could lead to negative economic implications and weigh down on the euro in the longer term.

U.S. June gold futures on the COMEX division of the NYMEX settled down $9.60 at $1,200.80 an ounce.

In bond markets, the premiums investors demand to buy peripheral euro zone government bonds rather than German benchmarks fell.

Greek bonds were the biggest gainers in the euro zone with the short-end outperforming, causing the 2/10-year yield curve to flatten sharply.

Liquidity in Greek bonds dried up last week with no trades going through.

They've attacked this problem from all angles and it's given a big boost to risk markets at the expense of government bonds, said Nick Stamenkovic, strategist at RIA Capital Markets in Edinburgh.

The benchmark 10-year U.S. Treasury note was down 33/32 in price to yield 3.54 percent.

In Asia, Hong Kong shares had their biggest one-day rise in five months, the MSCI ex-Japan index <.MIAPJ0000PUS> rose 3.4 percent, and Japan's Nikkei <.N225> ended up 1.6 percent.

(Reporting by Ryan Vlastelica, Wanfeng Zhou, Burton Frierson in New York; Christopher Johnson, William James, Brian Gorman in London; Writing by Herbert Lash; Editing bu Leslie Adler)