Stocks ended near the highs of the session, reversing a three-day losing streak as commodity prices rebounded, and as the Federal Reserve gave no indication in its latest minutes that it plans to tighten monetary policy soon.
The Dow Jones Industrial Average gained 80.60 points, or 0.65 percent, to close at 12,560.18.
Oil giants ExxonMobil and Chevron rose along with oil prices, and were among stocks that led the blue-chip index higher.
Hewlett-Packard led Dow laggards for a second day after the tech giant posted disappointing earnings results on Tuesday and received a downgrade from JPMorgan to "neutral" from "overweight." The brokerage also cut the PC maker's price target to $42 a share from $55, saying HP's revised outlook for the fiscal third quarter and the full year is a "major disappointment." In addition, at least four other brokerages also cut their price targets on the firm.
TheS&P 500 rose 11.70 points, or 0.9 percent, to close at 1,340.68, while the tech-heavy Nasdaq rose 31.79 points, or 1.14 percent, to close at 2,815.00. The CBOE Volatility Index, widely considered the best gauge of fear in the market, fell to nearly 16.
Among key S&P 500 sectors, materials and energy gained, while utilities fell, in a reversal of a trend seen over the last couple sessions.
The market got a lift on Wednesday from the dollar, which traded lower most of the session, and the fact "the negativity in the market is taking a little bit of a breather," said Quincy Krosby, market strategist at Prudential Financial.
Another factor is the expiration of stock index futures and options on Friday, Krosby said. "That really does tend to skew the markets a few days before," she said.
Also, market participants are beginning to think the Federal Reserve will continue to support an accommodative monetary policyin the months ahead.
On Wednesday, the Fed released policy minutes from its April meeting that outlined the central bank's thinking about how to tighten monetary policy when the time comes. The Fed stressed that their talk of any exit strategy doesn't mean they are ready to tighten monetary policy soon.
Most Fed officialsprefer to tighten policy through interest rate hikes rather than asset sales, according to the minutes of the Federal Reserve's policy setting meeting, which were released on Wednesday.
The central bank indicated they would eventually cut the Fed's portfolio, and that selling mortgage-related debt would be a priority, Reuters reported, describing the discussions of an exit strategy as "intense."