NEW YORK - U.S. stocks rose across the board Wednesday following big gains in Asia and Europe, a buoyant end to the worst quarter for the market in four years.

From worries over a slowing Chinese economy, uncertainty over interest rates, and a scary slide in commodity prices, stocks have been hit with one blow after another in the last three months. But on Wednesday, investors were in the mood to buy, especially stocks that have been battered recently.

The buying began at the opening of trading and swept across all 10 sectors of the Standard and Poor's 500 index. Among the big gainers, fashion company Ralph Lauren jumped 14 percent after announcing that a new CEO would take over from its namesake founder.

Tim Courtney, chief investment officer of Exencial Wealth Advisors, said it was only a matter of time before investors started buying, given the recent drops.

"I've been surprised we haven't had rallies like the one we're seeing now," Courtney said. After "so many negative days, you're going to get a bounce back."

The S&P 500 jumped 35.94 points, or 1.9 percent, to 1,920.03. The index has fallen seven of the last 10 days, and is off 6.9 percent in the July-September period, the worst quarterly performance since 2011.

The Dow Jones industrial average gained 235.57 points, or 1.5 percent, to 16,284.70. It fell 7.6 percent in the quarter. The Nasdaq composite climbed 102.84 points, or 2.3 percent, to 4,620.16.

The rally in the United States followed even bigger gains overseas. Stock indexes in France, Germany, Britain and Japan all climbed more than 2 percent.

The rocky third quarter began with fears over Greece's debt, then moved on to worries about a rout in Chinese stocks, signs of slowing growth in the country, and plunging currencies in developing countries that export to it. The S&P 500 dropped more than 10 percent in August from its May high, a drop known on Wall Street as a "correction."

"It's been ugly," said John Canally, an investment strategist at LPL Financial. "We hadn't had a 10 percent pullback since 2011, and people forget how to act."

All five of the biggest drops in the year for the S&P 500 occurred in the last three months. Investors were so jumpy that they even sold on news that previously would have triggered buying. When the Federal Reserve announced earlier this month that it would hold off raising interest rates, the S&P 500 slipped.

On Wednesday, investors mustered enough courage to buy even biotechnology companies, breaking an eight-day streak of drops for the battered sector.