Stock rally halts 3-day rout for S&P 500, Nasdaq

U.S. stocks rallied on Wednesday, with the S&P 500 and Nasdaq halting a three-day losing run, after an upbeat report on new-home sales and as investors bet on further monetary stimulus from the European Central Bank.

"The home-sales number was encouraging, and perversely enough Europe was fairly strong. The interpretation is bad news is going to accelerate" further monetary easing moves by the European Central Bank, said Mark Luschini, chief investment strategist at Janney Montgomery Scott.

"We've got central banks that are acting as they should and a housing market that is in transition, but improving; the market is going to start to reflect that," said Art Hogan, chief market strategist at Wunderlich Securities.

Bed Bath & Beyond jumped after the retailer reported quarterly results that beat expectations; Accenture fell after the technology consultancy projected quarterly revenue that missed estimates, and Merrimack Pharmaceuticals rallied after the company said it would develop its drug to treat pancreatic cancer outside the U.S. with Baxter International. Apple fell after the company pulled its iOS 8.0.1 update after multiple users reported serious issues with the new version of the operating system.

Read MoreMidday movers: Hasbro, KB Home, Transocean & more

The Commerce Department reported new-home sales rose 18 percent to 504,000 units in August after a 1.9 percent gain in July. Existing-home sales declined in August for the first time in four months.

"Housing is going to show a great deal of volatility as cash buyers transition to credit buyers, and by that I mean the folks that were paying cash as an investment in a depressed market are being replaced by natural home buyers that are now using credit," said Art Hogan, chief market strategist at Wunderlich Securities.

Ahead of the open, stock futures gained on hopes for more monetary stimulus from the ECB and after a measure of German business sentiment fell for a fifth straight month in September.


Equities furthered their ascent after Chicago Federal Reserve President Charles Evans said the central bank should be "exceptionally patient" in withdrawing stimulus.

Symbol
Name
Price
 
Change
%Change
DJIA
---
S&P 500
---
NASDAQ
---

After jumping 170 points, the Dow Jones Industrial Average climbed 154.19 points, or 0.9 percent, to 17,210.06, with Wal-Mart Stores among the companies leading blue-chip gains. The discount retailer struck a deal with Green Dot, a prepaid-card company, to offer checking accounts to its customers.

Home Depot erased losses that came after the Wall Street Journal reporting that a data breach at the home-improvement retailer had led to fraudulent transactions across the country.

The S&P 500 added 15.53 points, or 0.8 percent, to 1,998.30, with health care and consumer staples the best performing and utilities the hardest hit of its 10 major sectors.

The CBOE Volatility Index, one measure of investor uncertainty, fell 11.1 percent to 13.27.

The Nasdaq added 46.53 points, or 1 percent, to 4,555.22.

For every two shares falling, more than three rose on the New York Stock Exchange, where nearly 746 million shares traded. Composite volume neared 3.4 billion.

The Russell 2000 Index of smaller companies also gained, after forming a bearish indicator known as the 'Death Cross' in recent sessions in a possible signal of what's to come for the broader market.

"Some wounds were created over the last couple of days; people are seeing glaring weakness in small and mid-cap stocks, and certainly some technical damage has been done," said Peter Boockvar, chief market analyst at the Lindsey Group.

"The soldiers go before the generals, and the small-caps declining is usually an indicator something untoward taking place in the internals. On the other hand, valuations in small caps were exceedingly rich, so they were ripe for under performing," said Luschini.

"It's a legitimate reason to view it as a potential signal, but it is not definitely saying the market is set to roll over," Luschini added of the scenario where an index's 50-day moving average trend line drops below its 200-day moving average.

Read MoreSmall-cap retreat: An ominous sign or no big deal?

GYI0000537533.jpg
Getty Images

On track for an 11th weekly gain, the dollar rose against other global currencies and the yield on the 10-year Treasury note gained 4 basis points to 2.566.

"The dollar is up 6 percent in the third quarter along, the biggest quarterly gain in four years, with the strength of the dollar working against commodity prices," said Luschini.

Gold futures for December delivery declined $2.50 to $1,219.50 an ounce, and crude-oil futures for November reversed higher, up $1.24 to $92.80 a barrel.

On Tuesday, U.S. stocks declined, with the S&P 500 and Nasdaq falling for a third day to close at five-week lows, as investors weighed data illustrating a slowing global economy and tracked conflict in the Middle East.

Read MoreStocks fall amid global concerns; small caps hit again

—By CNBC's Kate Gibson

Coming Up This Week:

Thursday

8:30 a.m. Weekly jobless claims

8:30 a.m. Durable goods

1:20 p.m. Atlanta Fed President Dennis Lockhart

Friday

8:30 a.m. GDP revision

9:55 a.m. Consumer sentiment

More From CNBC.com: