Stocks edge higher, S&P 500 trims its weekly loss

    U.S. stocks indexes inched higher Friday, trimming their losses for the week. The gains were held back by a budget deadlock in Washington and worries that Europe’s debt crisis could spread.

    The stock market was headed for one of its worst weeks this year. Indexes have fallen four of the past five days after Italy appeared to be the next European country headed for a fiscal calamity.

    Those concerns ebbed after Europe’s banking authority said only eight banks failed the latest round of tests designed to show how well they would stand up under severe financial strain. A total of 90 banks were subject to the tests.

    The market opened higher after Google Inc., Mattel Inc. and Citigroup Inc. all reported strong quarterly earnings. Buyout offers for Clorox Co. and Petrohawk Energy Corp. also lifted stock prices.

    The Standard & Poor’s 500 index rose 3 points, or 0.3 percent, to 1,312 in afternoon trading. The Dow Jones industrial average rose 14, or 0.1 percent, to 12,451. The Nasdaq composite index rose 18, or 0.7 percent, to 2,781.

    In Washington, lawmakers and President Barack Obama made little visible progress in negotiations over raising the nation’s borrowing limit ahead of an Aug. 2 deadline. Credit rating agency Standard & Poor’s said Thursday there is a 50 percent chance it will downgrade the government’s credit rating within three months because of the impasse. A day earlier, Moody’s Investor Service said it is reviewing America’s bond rating for a possible downgrade.

    Many analysts believe that a default by the U.S. is unlikely and would be corrected quickly. But concerns about Europe and a weak data on U.S. factory output continued to weigh on stocks, as they have since early this spring.

    Those worries have kept traders’ expectations and stock prices relatively low, said Ryan Detrick, senior technical strategist Schaeffer’s Investment Research. If corporate earnings remain strong and Europe stabilizes, he said, stocks might rally in the second half of the year. That happened last year, after fears about Europe held the stock market back all summer.

    “With all the talk about European debt and the U.S. issues, the fact that earnings are coming in pretty strong is a good sign,” Detrick said. “Once those issues work their way through the system, long-term growth is going to come from earnings.”

    The government said early Friday that U.S. factories produced fewer autos in June and overall factory output was flat. It was third straight weak month for manufacturers. Auto production declined in all three months because automakers were unable to obtain parts after the earthquake and tsunami disaster in Japan.

    Major indices are down for the week following two weeks of gains. The S&P 500 is down 2.4 percent, the Dow 1.7 percent. Traders hoped to extend recent gains after an eight-week slump fed by Europe’s worsening debt troubles.

    Mattel shares rose 2 percent after the company said its net income jumped 56 percent in the second quarter, helped by strong demand for Barbie and “Cars 2” toys.

    Google jumped 13 percent, the most in the S&P 500 index, after the company said its income increased 36 percent from the year-ago quarter and revenue hit an all-time high. Google reported after the markets closed Thursday.

    Clorox Co. shares surged 8 percent after billionaire investor Carl Icahn offered to take the company private in a deal that values the household products company at $10.2 billion. He offered 12 percent more for shares than they were worth at Thursday’s close.

    U.S. oil and gas producers rose after Australian natural-resource giant BHP Billiton Ltd. said it would buy Petrohawk Energy Corp. for $12.1 billion, feeding speculation about which company might be the next takeover target. BHP was attracted to the long-term value of Petrohawk’s U.S. natural gas reserves.

    Petrohawk shares soared 63 percent, lifting other companies with natural gas holdings. Among the strongest gainers: Range Resources Corp. rose 10 percent, Cabot Oil & Gas Corp. rose 9 percent and Pioneer Natural Resources Co. and Southwestern Energy Co. rose 8 percent.