Stocks ended near the highs of the session, reversing a three-day losing streak as commodity prices rebounded.
The Dow Jones Industrial Average gained 80.60 points, or 0.65 percent, to close at 12,560.18.
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.
The S&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.
On Wednesdsay, 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.
Most Fed officials prefer 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."
Oil prices rebounded after a surprise drop in gasoline inventories, followed by an unexpected fall in crude supplies, the Energy Information Administration reported Wednesday. U.S. light, sweet crude rose 3.29 percent to settle at $100.10 a barrel, while in London, Brent crude rose 2.1 percent to close at $112.30.
The dollar traded flat against a basket of currencies, after trading lower earlier in the session. Precious metals prices gained, as gold settled up 1 percent to $1,495.60 an ounce, while silver settled up 4.8 percent at $35.09 an ounce.
The news in personal computer stocks wasn't all gloomy, as Dell led the tech sector higher after the PC maker reported better-than-forecast results. In addition, at least 12 brokerages raised their price targets on the firm.
Target, meanwhile, sank after the retailer topped earnings estimates, but fell short on sales. And Staples plunged after the office-supply chain posted disappointing same store sales and a weaker-than-expected profit. In addition, S&P Equity upgraded the firm to "buy" from "hold."
SodaStream soared more than 10 percent after the home carbonation system maker raised its outlook for the year, and reported strong sales.
Among other tech stocks, Research In Motion gained after Sanford C. Bernstein upgraded the Blackberry maker to "market perform" from "underperform," saying the stock is cheap, and is unlikely to deteriorate further despite the fact the company's management "remains in denial of challenges facing the company."
And shares of Hershey fell after news CEO David West will become CEO of Del Monte Foods, which was taken private by Kohlberg Kravis Roberts earlier this year. West's departure comes less than four years since he became Hershey's CEO.
LinkedIn is expected to sell $341 million worth of shares to the public this evening. This comes after the social networking firm raised the expected price range of its IPO by 30 percent Tuesday. The firm is expected to start trading on the NYSE tomorrow under ticker symbol "LNKD."
Also on the IPO front, Oaktree Capital Management is planning to list its shares on the NYSE in a deal valuing the cmpany between $8 billion and $9 billion, according to the Financial Times.
On the economic front, falling mortgage rates boosted home loan refinancing last week. The Mortgage Bankers Association's seasonally adjusted index of mortgage application activity rose 7.8 percent in the week ended May 13, boosted by a 13.2 gain in refinancings. Home loan applications fell 3.2 percent.
European stocks closed higher, boosted by gains in techs and miners.