Stocks advanced on Monday, as the S&P 500 bounced off a key support level and Greece was given an ultimatum by euro-zone ministers in an effort to deal with its debt crisis.

Euro-zone finance ministers gave Greece two weeks from Monday to approve stricter austerity measures in return for another 12 billion euros in emergency loans, piling pressure on Athens to get its ragged finances in order.

The sense is that Greece is going to get their money -- there is going to be a little bit of a fight, but the sense is the European Union is not going to let Greece default. They are not going to let them go under, so therefore that is holding the market, said Ken Polcari, managing director at ICAP Equities in New York.

Wall Street opened lower, but erased losses as the S&P 500 dipped toward 1,259.78, its 200-day moving average, encouraging buyers. A drop below that level would be the first since September 2010.

The fact we bounced off the 200-day (moving average) and we are moving higher, and the VIX is kind of coming off a little bit, so that fear in the market seems to be subsiding. It's all a positive thing, in terms of technically for the market, Polcari said.

But you get a really negative headline out of Europe, and it all goes away.

The Dow Jones industrial average <.DJI> gained 70.35 points, or 0.59 percent, to 12,074.71.The Standard & Poor's 500 Index <.SPX> rose 5.42 points, or 0.43 percent, to 1,276.92. The Nasdaq Composite Index <.IXIC> added 5.65 points, or 0.22 percent, to 2,622.26.

The CBOE Volatility Index <.VIX>, known as the VIX, shed 4.1 percent to 20.96.

The euro-zone finance ministers expect the money, the next tranche in a 110-billion-euro bailout of Greece by the European Union and the International Monetary Fund, to be paid by mid-July. Greece needs the loans by then to avoid a debt default.

In company news, the U.S. Food and Drug Administration approved a tamper-resistant pain drug from Pfizer Inc
and Acura Pharmaceuticals Inc . Acura shares jumped 28.9 percent to $4.99, while shares of Pfizer, a Dow component, slipped 0.3 percent to $20.20.

Wal-Mart Stores Incx gained 1 percent to $53.35 after the U.S. Supreme Court ruled for the retail giant in the largest sex-discrimination lawsuit in history, saying class-action status for female employees seeking billions of dollars had been improperly granted.

(Reporting by Chuck Mikolajczak; Editing by Jan Paschal)