Stocks rallied on Wednesday, reversing three days of losses on hopes the European debt crisis might ease after Germany's top court smoothed the way for Berlin's participation in bailout packages.

The S&P and Nasdaq both topped 2 percent, and all ten S&P sector indexes were higher in a broad rally.

European stocks bounced back from a two-year low after the German court rejected lawsuits aimed at blocking the country from joining in to aid Greece and other nations.

But the court said the government must get approval from a parliamentary committee, which could further slow a response. The FTSEurofirst 300 index of top European shares closed up 3 percent. <.

While a resolution to the issues in Europe is not immediate, this shows that they seem to be on the path of making some progress, said Howard Ward, chief investment officer at GAMCO Growth in Rye, New York. That's a huge positive.

The Dow Jones industrial average <.DJI> advanced 186.45 points, or 1.67 percent, at 11,325.75. The Standard & Poor's 500 Index <.SPX> was up 24.11 points, or 2.07 percent, at 1,189.35. The Nasdaq Composite Index <.IXIC> jumped 52.81 points, or 2.13 percent, at 2,526.64.

Yahoo Inc shares gained 4.3 percent to $13.47 after its chairman, Roy Bostock, abruptly fired Chief Executive Carol Bartz on Tuesday, ending a tumultuous tenure marked by stagnation and a rift with Chinese partner Alibaba.

Bank of America Corp rose 5.6 percent to $7.39 and was the top percent gainer on the Dow after the heads of its consumer banking and global wealth and investment management units left in a management shake-up. The Dow component has lost almost half of its market value this year.

The financials have been pounded mercilessly, and we're starting to get a real bid under their valuation, said Ward, who helps oversee $36.1 billion in assets under management.

The CBOE Volatility index <.VIX> fell 7.6 percent after spiking 9 percent on Tuesday. The index usually moves inversely to the S&P 500.

Darden Restaurants Inc was the biggest loser on the S&P, falling 3.4 percent to $44.59 a day after the operator of the Red Lobster and Olive Garden chains warned that Hurricane Irene hurt first-quarter earnings.

Nvidia Corp climbed 8 percent to $14.23 a day after the chipmaker forecast 2013 sales that topped expectations.

About 87 percent of stocks traded on the New York Stock Exchange were in positive territory, while 83 percent of the Nasdaq rose. About 2.89 billion shares traded on the New York Stock Exchange, the American Stock Exchange and Nasdaq -- lower than last year's average, as of midday.

(Editing by Jeffrey Benkoe)