U.S. stocks mostly rose on Monday, spurred on by retail sales in March that surprised on the upside and suggested economic growth was not as weak as many had feared, but worries about Spain's fiscal problems fuelled a bid for safe-haven government debt.

The dollar retreated against the euro and oil prices fell after Spain acknowledged it has probably tipped into its second recession since 2009.

Spanish 10-year government bond yields broke through the 6 percent mark for the first time since December, sparking a record-breaking rally in low-risk German debt.

Spanish yields were expected to continue rising toward the 7 percent level - beyond which debt costs are widely viewed as unsustainable - unless the European Central Bank resumes its bond purchases after a two-month break.

The overall mood is one of risk aversion after the news from Spain, said Eugen Weinberg, an energy analyst at Commerzbank in Frankfurt.

Credit default swap spreads are at record high levels and Spanish banks are having trouble getting money in the markets and are going to the European Central Bank instead. That is weighing on sentiment, Weinberg said.

Concern is growing that the recession will make it impossible to meet deficit targets and that Spain will have to seek some form of international bailout even as the Spanish government says it is committed to making major budget cuts.

But on Wall Street, the good news on retail sales helped drive gains. U.S. retail sales increased 0.8 percent after rising 1.0 percent in February, the Commerce Department said, as Americans shrugged off high gasoline prices.

The sales gain surpassed economists' expectations for only a 0.3 percent rise and could prompt analysts to raise their first-quarter economic growth forecasts of about 2.5 percent annually.

The Nasdaq fell sharply, weighed down by a 3.2 percent drop in Apple Inc , but the Dow remained firmly in positive territory and the broad S&P 500 index rose after earlier trading at break-even.

The Dow Jones industrial average <.DJI> was up 123.14 points, or 0.96 percent, at 12,972.73. The Standard & Poor's 500 Index <.SPX> was up 4.33 points, or 0.32 percent, at 1,374.59. The Nasdaq Composite Index <.IXIC> was down 14.40 points, or 0.48 percent, at 2,996.93.

Apple was down 3.3 percent at $585.20 after hitting a record high last week of $644. Some investors said Apple, which is up 45 percent this year, broke a trend line on Monday at around the $596 level, leading to more profit taking.

European shares regained poise, as the U.S. retail sales data gave investors the excuse to jump back into an oversold asset class, partly eclipsing concern about Spanish debt.

The pan-European FTSEurofirst 300 <.FTEU3> closed 0.5 percent higher at 1,032.43 points.

The cost of insuring Spanish debt against default hit a record high at 522 basis points, meaning it costs $522,000 a year to buy $10 million of protection, according to data from Markit.

German Bund futures rose to a new high of 140.56, up 20 ticks on the day, while 10-year German Bund yields set a record low earlier in the session at 1.622 percent.

The mixed performance in the stock market also supported U.S. Treasuries prices.

The dollar was down against a basket of major trading-partner currencies, with the U.S. Dollar Index <.DXY> down 0.48 percent at 79.506.

The euro was up 0.51 percent at $1.3142, and against the Japanese yen, the dollar was down 0.58 percent at 80.42 yen.

The benchmark 10-year U.S. Treasury note was up 8/32 in price to yield 1.96 percent.

A stumble in stocks works to the benefit of safe-haven U.S. government debt.

The euro would be vulnerable to further losses if Madrid fails to put a halt to the steady erosion in market confidence in its ability to manage its massive load of debt, said Joe Manimbo, senior market analyst at Western Union Business Solutions in Washington.

Oil futures extended losses to more than 2 percent on news that the reversal of the Seaway crude oil pipeline, which will carry crude from the U.S. Midwest to the Gulf Coast, would begin earlier than expected if regulatory approval is secured, sparking heavy transatlantic spread trading.

The further drop in futures added to a bearish mood in the oil markets, which had earlier felt pressure on euro zone worries triggered by Spain's debt problems and weekend talks between Iran and six world powers about its disputed nuclear program.

Brent crude for June delivery was down $2.47 at $118.74 a barrel.

U.S. crude for May delivery which expires on Friday, rose 34 cents at $103.16.

(Additional reporting by Richard Hubbard in London; Editing by Leslie Adler)