Encouraging economic indicators sent U.S. stocks higher on Friday, but the market's recent struggles are set to continue into next week when more than one-fifth of S&P 500 companies report results.

The S&P 500 fell for a second straight week, and some in the market pointed to strong resistance building around 1,340. The daily chart shows a bearish double top near that level.

In another worrisome sign, investors again favored defensive stocks, which tend to do better in times of waning growth. Utilities <.GSPU> and healthcare <.GSPA> were the S&P 500's top-performing sectors.

Disappointing results from Google and Infosys weighed on technology shares, while financials were pressured by Bank of America's results.

Even while some of the earnings (were not) exactly what the market hoped for, the macro economic data was actually pretty good this morning, said Paul Zemsky, head of asset allocation at ING in New York.

Consumer price inflation remained contained in March while industrial production increased. A separate survey showed improvement in consumer sentiment in April.

Investors have been concerned that higher energy and food costs would slow consumer spending, while at the same time force the Federal Reserve to tighten its very loose monetary policy earlier that anticipated.

The Dow Jones industrial average <.DJI> gained 56.68 points, or 0.46 percent, to 12,341.83. The Standard & Poor's 500 Index <.SPX> rose 5.16 points, or 0.39 percent, to 1,319.68. The Nasdaq Composite Index <.IXIC> added 4.43 points, or 0.16 percent, to 2,764.65.

For the week, the Dow fell 0.3 percent while the S&P 500 and the Nasdaq each lost 0.6 percent.

The CBOE Volatility Index or VIX <.VIX> dropped 5.8 percent to close at 15.82, its lowest level since July 2007.

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, said Randall Warren, chief investment officer of Warren Financial Service in Exton, Pennsylvania. But right now, it could go either way, and it looks like the market wants to go up.

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 2.4 percent to $12.82 and was the Dow's bigger percentage loser.

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

Also hurting technology stocks, Infosys Technologies Ltd , India's No. 2 software services exporter, sparked worries about the sector's growth after it forecast annual sales lower than expected on slower client spending. Its U.S.-traded shares fell 13.4 percent to $63.21.

Information technology <.GSPT> was the sole S&P sector to fall. The IT sector's index fell 0.4 percent.

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 2.1 percent to $18.61.

Bond insurer Assured Guaranty Ltd surged 24.2 percent to $17.60 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 17.4 percent to $10.48, also on heavy volume.

About 7.1 billion shares traded on the New York Stock Exchange, NYSE Amex and Nasdaq, below last year's estimated daily average of 8.47 billion.

Advancing stocks outnumbered declining ones on the NYSE by a ratio of more than 2 to 1, while on the Nasdaq, more than nine stocks rose for every five that fell.

(Reporting by Rodrigo Campos; Additional reporting by Ryan Vlastelica; Editing by Jan Paschal)