Traders on the floor of NYSE
WJB Capital Group Inc. announced Tuesday that the Wall Street firm is halting its brokerage operations after a difficult year. The firm now also faces a lawsuit by an investor, James McNally, alleging fraud. Reuters

U.S. stocks cut losses late in Wednesday's trading session, with two key indexes barely squeaking into positive territory on the strength of surging commodities prices and the shares of companies that produce them.

Traders said the late recovery reflected the hope that prospects of global carnage because of a Greek exit from the euro zone would simply force central bankers to intervene.

The price of gold, which concludes its open outcry trading session more than two hours before the stock markets settles, spent most of the day falling as much as 2 percent before closing down 1.8 percent. But in after-hours electronic trading, gold rose 0.75 percent. Copper fell 2.6 percent in regular trading but then began climbing in electronic trading.

The S&P 500 climbed 2.23, or 0.17 percent, to settle at 1,31886, and the Nasdaq Composite rose 11.04, or 0.39 percent, to close at 2,850.12. The blue chip Dow Jones Industrial Average fell 6.66, or 0.05 percent, to end the day at 12,496.15.

The late-session recovery in equity markets was matched by declines in the dollar, which had risen for most of the regular session. The yield on the benchmark 10-year bond fell to 1.72 percent.

Asian and European stocks ended sharply lower, with France's CAC 40 down 2.6 percent and Britain's FTSE 100 down 2.5 percent.