U.S. stocks closed more than 1.5 percent higher Wednesday for their largest three-day gain since late August, helped by some recovery in oil prices and encouraging economic data. (Tweet This)
The Dow Jones industrial average and S&P 500 posted their first three-day win streak of 2016. The S&P also had its third-straight day of plus-1 percent gains since 2011.
"The strength of this rebound, what it's showing to me is, people want to be in this market," said Tom Siomades, head of Hartford Funds Investment Consulting Group.
He said signs that "China is not going to implode" and stabilization in oil prices, which topped $30 a barrel Wednesday, supported gains.
In the last three trading days the Dow gained 5.07 percent, the S&P 500 rose 5.34 percent, and the Nasdaq composite surged 6.26 percent, marking their largest three-day gain since Aug. 28, 2015. U.S. markets were closed Monday for Presidents Day.
"I think the economic statistics probably took over more than anything. When the markets were coming down there was a big fear of recession," said Ben Pace, chief investment officer at HPM Partners. The recent data shows "we might be slow from an economic perspective but we're not close to a recession."
"I think stocks are rallying on economic fundamentals and the fact that oil is up," he said.
U.S. crude oil futures settled up $1.62, or 5.58 percent, at $30.66 a barrel, holding most of their gains after comments from the Iran oil minister raised hopes for the possibility of cooperation on an agreement to freeze production.
Luana Siegfried, energy research associate at Raymond James, was skeptical of the likelihood of a deal. "So far it's more trading on news than any specific fact," she said, also attributing the gains in oil to a rebound from Tuesday's decline.
Iran Oil Minister Bijan Zanganeh said he supports any effort to stabilize the market and prices, according to a Reuters report citing the Iranian oil ministry's official Shana news agency. The Iran oil minister also said in the report the Tehran oil producers meeting was good.
Zanganeh did not explicitly say in his remarks quoted by Shana that Iran would keep its own output at its January level.
"You have the credible possibility for progress that finally makes sense," said Art Hogan, chief market strategist at Wunderlich Securities.
"The narrative continues to get louder and more believers in a commodity complex that was leaning in the wrong direction to begin with," he said.
The major averages closed off session highs. Earlier, stocks extended gains after the afternoon release of the Fed minutes with the Dow briefly adding 289 points to swing into positive territory for February in intraday trade. The index ended the session up about 257 points, or down 0.08 percent for the month so far. Boeing contributed the most to gains in the Dow.
The S&P 500 topped the psychologically key 1,900 level in the close for the first time since Feb. 4 and ended within 10 percent of its 52-week intraday high, out of correction territory. Energy closed nearly 3 percent higher to lead advancers.
John Caruso, senior market strategist at RJO Futures, attributed most of the rally Wednesday to a short squeeze. "I do believe this rally is going to run out of steam pretty soon. We have got some irrational exuberance going on over here," he said.
The Nasdaq composite outperformed, closing 2.2 percent higher as Priceline surged 11.2 percent. The travel website operator reported a higher-than-expected quarterly profit after hotel and rental car bookings rose, with travel demand suffering only briefly from the Nov. 13 Paris attacks, Reuters said. Apple gained 1.5 percent, while the iShares Nasdaq Biotechnology ETF (IBB) rose 2.9 percent.
In economic news, industrial production for January rose 0.9 percent, while capacity utilization was 77.1 percent.
"I think the recent macro indicators we have received have been sufficiently positive to provide a lift to equities for now," John Lonski, chief economist at Moody's, said, noting Friday's better-than-expected retail sales and Wednesday's industrial production report.
"We have indications that U.S. spending will provide sufficient buoyancy to corporate revenues and profitability in 2016," he said. "Nevertheless, the performance by both categories will be below average for an economic recovery."
U.S. producer prices unexpectedly rose last month, rising 0.1 percent after falling 0.2 percent in December. Excluding food and energy, PPI rose 0.4 percent.
Housing starts fell 3.8 percent in January, while building permits fell 0.2 percent.
The minutes from the latest Federal Reserve meeting showed policymakers worried last month that tighter global financial conditions could hit the U.S. economy and considered changing their planned path of interest rate hikes in 2016.
The "market is thinking the Fed is going to be more supportive and cognizant of emerging market slowdown," said Krishna Memani, chief investment officer at Oppenheimer Funds.
"The data flow over the last week or two has actually been OK. What (policymakers are) worried about is more long-term issues that hang over the market," he said, referring to China, financial market volatility and the strong dollar.
Treasury yields held near earlier highs, with the at 0.75 percent and the 10-year yield at 1.81 percent. Both yields hit their highest in more than a week.
The U.S. dollar index traded flat, with the euro near $1.113 and the yen at 113.89 yen against the greenback.
St. Louis Fed President James Bullard is due to speak after the market close.
As of Wednesday's close, the major averages are on pace for weekly gains of 3 percent or more.
"The S&P futures are seeing positive follow-through this morning after a strong close yesterday," BTIG Chief Technical Strategist Katie Stockton said in a morning note. "The oversold bounce is supported by short-term positive divergences in our most sensitive momentum indicators. We expect the rally to persist into next week, but we would use it to take down exposure to stocks that have broken down."
The Dow transports closed up 1.6 percent.
The closed up 31.24 points, or 1.65 percent, at 1,926.82, with energy leading nine sectors higher and utilities the only decliner.
The Nasdaq composite closed up 98.11 points, or 2.21 percent, at 4,534.06.
The CBOE Volatility Index (VIX), widely considered the best gauge of fear in the market, held just above 22.
About five stocks advanced for every decliner on the New York Stock Exchange, with an exchange volume of 1.2 billion and a composite volume of nearly 5.0 billion in the close.
Gold futures for April delivery settled up $3.20 at $1,211.40 an ounce.
—Reuters and CNBC's Robert Hum and Chris Hayes contributed to this report.
Correction: This story has been updated to reflect that Hogan said the possibility for cooperation was credible.
On tap this week:
Earnings: Marriott, NetApp, Newmont Mining, Marathon Oil, Morningstar
6 p.m. St. Louis Fed President James Bullard
Earnings: Wal-Mart, Nordstrom, Applied Materials, Duke Energy, Discovery Communications, Hyatt, MGM Resorts, Dish Networks, Kate Spade, Crocs, Scana, SodaStream, Toro, Dana Holdings, Fluor, Imax, Six Flags, BJ's Restaurant, Boston Beer, WageWorks
8:30 a.m. Initial claims; Philadelphia Fed survey
10 a.m.: Leading indicators
10:30 a.m.: Natural gas inventories
11 a.m.: Oil inventories
3:30 p.m. San Francisco Fed President John Williams
4:30 p.m.: Fed balance sheet
Earnings: Deere, Public Service, VF Corp, Cabot Oil and Gas, Allianz, Pinnacle West, Echostar
8:30 a.m. CPI
8:40 a.m. Cleveland Fed President Loretta Mester
1 p.m.: Oil rig count
*Planner subject to change.
More from CNBC.com: