NEW YORK ( TheStreet) -- Stocks closed mixed Friday as the highest reading on consumer sentiment in more than four years limited the fallout from JPMorgan Chase's ( JPM) surprise $2 billion trading loss.

The performance capped a second consecutive week of losses for the major U.S. equity indices with trading driven by resurgent worries about Europe following transformational elections in France and Greece that cast doubt on region's ability to commit to austerity. There were also signs of growing cracks in the Spanish banking system.

The Dow Jones Industrial Average fell 34 points, or 0.27%, to close 12,820.60. The blue-chip index fell 1.7% for the week, and is now up 4.9% so far in 2012.

The S&P 500 lost 4.6 points, or 0.34%, to finish at 1353.39. The index lost 1.1% on the week, and is up 7.6% year-to-date on a price basis.

The Nasdaq rose less than a point, or 0.01%, to settle at 2933.82. It slumped 0.8%% on the week, and stands with a gain of 12.6% for 2012.

Breadth within the Dow was negative with 18 of the index's 30 components moving lower. JPMorgan was the big drag, losing 9.3%. Bank of America ( BAC) suffered as well, down 2%.

Cisco ( CSCO) fell another 1.8%, adding to Thursday's deep decline following its weak outlook for the current quarter.

The biggest percentage gainers among the blue chips were clustered in tech, led by Intel ( INTC), Microsoft ( MSFT), AT&T ( T) and Verizon ( VZ).

In the broader market, the number of losers outpaced winners by a ratio of 1.5-to-1 on the New York Stock Exchange and was 1.4-to-1 on the Nasdaq.

On the macro front, the University of Michigan consumer sentiment index rose to 77.8 in May from a prior reading of 76.4 in April -- much stronger-than-expected -- and the highest level since January 2008. Economists, on average, thought the reading would tick down to 76 and generally attributed the rise that happened instead to the recent drop in gasoline prices.

Amna Asaf, an economist at Capital Economics, warned though that if equity prices continue on their downward trend, any further fall in gasoline prices may not be enough to hold up consumer confidence for much longer.

"Overall, the preliminary reading isencouraging, but we suspect that the final reading of confidence, which will be more affected by the most recent slump in stock markets, could be notably weaker than this."

Dan Greenhaus, chief global strategist at BTIG, added that if the labor market remains weak and the stock market declines further, there is an almost "assured guarantee that sentiment would move lower in tandem."

In other U.S. economic news, the Labor Department reported that the producer price index for April fell 0.2%, when economists, on average, expected it to be flat. The core PPI, which excludes food and energy, rose 0.2% as expected.

The lower headline number was driven by energy prices, which fell 1.4%. Eric Green, chief economist at TD Securities, expects that over the coming months, the PPI will continue to trend lower.

"That is good for profit margins in a time of rising unit labor costs," said Green. "On the retail side it is a positive for real income growth."

In Europe, London's FTSE rose 0.6% and the DAX in Germany settled up 0.95%.

The big story of the day stateside was JPMorgan's disturbing revelation late Thursday of a stunning $2 billion trading loss in the bank's synthetic credit portfolio.

JPMorgan CEO Jamie Dimon said the bank's corporate division could post a $800 million after-tax loss because of the "egregious" trading mistake. The unit was previously seen posting a loss of roughly $200 million.

"The JPMorgan ... was not necessarily above reproach, but they were certainly one of the more well-respected, and viewed as more secure banks out there," said Jonathan Upton, strategist, Lamkin Wealth Management.

The bank plans to continue to reposition its portfolio, and Dimon warned that there could be more volatility from this repositioning that could result in losses of up to $1 billion in the current quarter.

The news contributed to a 1.2% loss in the KBW Bank Index , and weighed on JPMorgan's big bank brethern with Citigroup ( C), down 4.2%; Morgan Stanley ( MS), down 4.2%; and Goldman Sachs ( GS), down 3.9%.

While JPMorgan's losses overtook European headlines, troubles across the pond continued lurking in the background with Greece still in the process of trying to cobble together a government and Spain seeking to force the nation's troubled banks into increasing real estate loan-loss provisions by €30 billion ($38 billion).

Spain is now planning to hire two auditors to examine all the assets of the country's banks.

The European Commission warned Friday that Spain was at risk of seriously missing its deficit targets this year and next year.

In Asia, the Hang Seng Index in Hong Kong finished down 1.3% and Japan's Nikkei average fell 0.6% after China said its industrial production rose 9.3% in April from a year ago, the slowest move in two years.

The benchmark 10-year Treasury rose 1/32, diluting the yield to 1.848%. The greenback was up 0.13%, according to the dollar index.

In commodity markets, the June crude oil contract was lost 95 cents to settle at $95.13 a barrel. June gold futures fell $11.50 to settle at $1,584.00 an ounce.

In other corporate news, shares of Nvidia ( NVDA) jumped about 6.4% after the graphics chip maker projected second-quarter revenue of $990 million to $1.05 billion, topping the average Wall Street estimate of $976.2 million, according to analysts.

Arena Pharmaceuticals ( ARNA) said late Thursday that a Food and Drug Administration advisory panel recommended approval of the company's diet drug lorcaserin.

Arena said it's working with the agency as it finishes its review. A final decision from the FDA could be made June 27. Lorcaserin could be the first new prescription diet drug in over a decade in the United States. The stock has soared 73.8%.

Specialty women's apparel chain Cache ( CACH) reported a first-quarter loss of $1.2 million, or 9 cents a share, wider than the year-earlier loss of $772,000, or 6 cents a share. Analysts, on average, expected a loss of 9 cents a share. Shares were down 2.3%.

ReneSola ( SOL) reported first-quarter a loss of $40.2 million, or 23 cents a share, a reversal from year-earlier earnings of $43.3 million, or 24 cents a share. On average, analysts were expecting earnings of 31 cents a share. Shares popped 3.4%.

-- Written by Andrea Tse and Joseph Deaux in New York.

>To contact the writer of this article, click here: Andrea Tse.

More from Markets

FTC Chair Says Agency Is Ready to Take on Big Tech; Walgreens Joins Dow -- ICYMI

FTC Chair Says Agency Is Ready to Take on Big Tech; Walgreens Joins Dow -- ICYMI

Dow Gets Swept Into Nasty Reversal Even as Nasdaq Posts New Record

Dow Gets Swept Into Nasty Reversal Even as Nasdaq Posts New Record

Zoom CEO Eric Yuan Leads Glassdoor's List of Top 100 CEOs

Zoom CEO Eric Yuan Leads Glassdoor's List of Top 100 CEOs

REPLAY: Jim Cramer on Fed Rate Hikes, Oil Prices and Starbucks Worries

REPLAY: Jim Cramer on Fed Rate Hikes, Oil Prices and Starbucks Worries

3 Must Reads on the Market From TheStreet's Top Columnists

3 Must Reads on the Market From TheStreet's Top Columnists