Hopes that policymakers are working toward a solution to the debt crisis lifted global shares on Monday, but a late-day credit warning from Standard & Poor's underscored what was at stake.

Reports that the warning was coming caused U.S. stocks to cut gains in the afternoon, while the euro retreated. S&P said after the closing bell that it may downgrade the credit ratings of 15 euro zone countries.

S&P placed the ratings of euro zone countries, including top-rated Germany and France, on credit watch negative -- an unprecedented move that signals a possible downgrade within three months.

U.S. stock index futures dipped after the news. The euro last traded at $1.3385, down 0.1 percent on the day, near a session low of $1.3374 on Reuters data.

We know Europe is facing a dire situation here and this action seems appropriate. Ultimately, it may be S&P signalling to the EU, 'This is it,' that they've got to get something done now, said Brian Dolan, chief strategist at Forex.Com in Bedminster, New Jersey.

If they are trying to send a message, now is a good time.

The rating agency's move came as the leaders of France and Germany agreed to a master plan for imposing budget discipline across the region ahead of a summit on Friday.

The proposal from French President Nicolas Sarkozy and German Chancellor Angela Merkel included automatic penalties for governments that fail to keep their deficits under control.

Wall Street ended off the day's highs, though it was still near 1 percent higher. World stocks as measured by MSCI <.MIWD00000PUS> gained 0.8 percent, also off earlier highs.

The Dow Jones industrial average <.DJI> gained 78.41 points, or 0.65 percent, to 12,097.83. The Standard & Poor's 500 Index <.SPX> rose 12.80 points, or 1.03 percent, to 1,257.08. The Nasdaq Composite Index <.IXIC> climbed 28.83 points, or 1.10 percent, to 2,655.76.

European stocks hit a five-week closing high, though analysts were wary the optimism could prove overdone.

We are far from an easy consensus that it's a done deal, said Marc Pado, U.S. market strategist at Cantor Fitzgerald & Co in San Francisco. But we are further along in the negotiations than we've been and we are focused on the right things now.

There were signs not everyone was convinced of a positive outcome in Europe. Interbank dollar borrowing costs inched up as uncertainty over policymakers' ability to contain the crisis made banks wary of lending to each other.

Investors are hoping the agreement will pave the way for the European Central Bank to buy large amounts of government bonds to try to stop the crisis from spreading.

Deep austerity measures from Italy assuaged investor fears and sent Italian bond yields further below the worrying 7 percent level.

Italian Prime Minister Mario Monti presented a 30-billion-euro austerity package to parliament, saying the country risked a Greek-style economic collapse without it.

Ten-year Italian government bond yields slumped 72 basis points to 6.03 percent -- its lowest in a month.

But Monday's data highlighted the precarious world economic situation. Purchasing manager surveys for November showed the euro zone's economy may be shrinking more quickly than previously thought, while growth in China's services sector sagged to a 3-month low.

While the U.S. economy is still expected to avoid another recession, the day's data was also downbeat, with growth in the services sector slowing in November and new orders declining in October for a second straight month.

This is the first disappointing indicator we've seen in the last couple of weeks, Cary Leahey, managing director at Decision Economics in New York, said of the U.S. data.

The economy has improved, it is still not growing very quickly.

(Additional reporting by Caroline Valetkevitch and Edward Krudy; Editing by Dan Grebler)