Stocks advanced slightly in volatile trading on Friday after results from the European banks' stress tests came out slightly better than expected.

Wall Street started off higher, boosted by strong earnings from Google and Citigroup but soon gave up gains on concerns over the European banks' stress tests.

Basically, all the relatively big banks passed, so that calmed (the market) but I guess the next item to discuss would be: 'Were the tests strong enough?' said Kevin Kruzenski, head of listed trading at KeyBanc Capital Markets in Cleveland.

The European Banking Authority (EBA) said that out of the 90 European banks, eight of them failed stress tests -- far fewer than what the market was anticipating.

The Dow Jones industrial average <.DJI> was up 3.82 points, or 0.03 percent, at 12,440.94. The Standard & Poor's 500 Index <.SPX> was up 2.76 points, or 0.21 percent, at 1,311.63. The Nasdaq Composite Index <.IXIC> was up 18.95 points, or 0.69 percent, at 2,781.62.

But the CBOE Volatility Index <.VIX>, Wall Street's fear gauge, still hovered above 20, even though it was down 1.6 percent for the day.

With the European banks' stress test out of the way, the market has stabilized a bit. But we still have a lot to be nervous about, mainly the U.S. debt ceiling issue, said Randy Frederick, director of trading and derivatives at the Schwab Center for Financial Research in Austin, Texas.

Energy and tech shares led the day's gains. The S&P energy sector index <.GSPE> rose 2 percent and the S&P info technology sector index <.GSPT> gained 1.2 percent.

Consumer discretionary stocks were among the biggest drags after a report showed U.S. consumer sentiment slipped in July to its lowest level since March 2009, according to the Thomson Reuters/University of Michigan survey.

Home Depot fell 0.8 percent to $35.68, while the S&P 500's discretionary index <.GSPD> shed 0.4 percent.

Google Inc's earnings beat the most bullish forecasts late on Thursday, driving its stock up 12.8 percent to $596.60, and lifting the Nasdaq.

Citigroup Inc posted higher net income, helped by falling credit losses. But the stock dropped 1.4 percent to $38.47 in afternoon trading after being in positive territory in the morning

Two large merger offers also improved investor sentiment. BHP Billiton's $12 billion offer to purchase Petrohawk lifted shares in the energy sector, and investor Carl Icahn's offer to buy Clorox Co for $10.2 billion pushed the consumer products company's stock up 7.7 percent to $73.70.

BHP Billiton's bid for Petrohawk, which jumped 62.5 percent to $38.18, drove up shares in the energy sector as investors speculated that more deals are ahead. Chesapeake Energy rose 6.7 percent to $32.24, while the Select Sector Energy SPDR Fund , an exchange-traded fund, rose 2.3 percent to $76.62.

As deadlock in Washington's budget talks sets in, ratings agency Standard & Poor's warned there was a 1-in-2 chance it could cut the United States' top rating if a deal to raise the government debt ceiling is not reached soon.

(Reporting by Angela Moon; Editing by Jan Paschal)