Stocks rose on Friday as encouraging economic indicators overshadowed disappointing results from Bank of America and Google.

A government report showed underlying inflation pressures remained contained in March, while a survey showed April consumer sentiment rose more than expected. Investors have been concerned that higher energy and food costs would slow consumer spending.

I'm surprised the market is holding up so well, given Google and Bank of America. But everyone is happy with the consumer price number, said Randall Warren, chief investment officer of Warren Financial Service in Exton, Pennsylvania.

People were afraid that inflation could derail the bull market, and this data puts that story on hold.

Still, investors placed most of their bets on defensive stocks, which tend to outperform in times on waning growth. Utilities <.GSPU> and healthcare <.GSPA> were the top-performing sectors on the S&P 500, both up more than 1 percent.

The Dow Jones industrial average rose <.DJI> 71.18 points, or 0.58 percent, to 12,356.33. The S&P 500 <.SPX> gained 7.14 points, or 0.54 percent, to 1,321.66. The Nasdaq Composite <.IXIC> rose 6.78 points, or 0.25 percent, to 2,767.00.

Bank of America Corp reported a steeper-than-expected decline of 37.5 percent in profit and named a new chief financial officer. The stock fell 1.6 percent to $12.92 and was the Dow's bigger percentage loser.

Google Inc late on Thursday unnerved investors with a large jump in first-quarter spending. The Internet company also reported an adjusted profit slightly under expectations. The stock sank 7.1 percent to $537.38.

Information technology <.GSPT> was the sole S&P sector to fall in afternoon trading.

The first week of earnings has been a mixed bag, with some bellwether companies unable to excite the market despite some cases of stronger-than-expected profits. Investors have been disappointed with companies' revenues or outlooks.

If this theme of discouraging reports continues, I'll become more bearish on the season. But right now, it could go either way, and it looks like the market wants to go up, Warren said.

Charles Schwab Corp reported first-quarter earnings that beat expectations by a penny. The broker also said clients had reduced the percentage of their cash assets held in Schwab to pre-crisis levels. The stock rose 3.1 percent to $18.79.

Bond insurer Assured Guaranty Ltd surged 25.1 percent to $17.73 on heavy volume after the company announced an agreement with Bank of America on mortgage repurchase claims. Among other companies in the sector, MBIA Inc climbed 21.6 percent to $10.86 and PMI Group

was up 2.8 percent to $2.24, both on heavy volume.

(Reporting by Ryan Vlastelica and Rodrigo Campos; Editing by Kenneth Barry)