U.S. stocks rose on Wednesday, lifted by a broker's upgrade of Merck & Co and a higher profit outlook from Kraft Foods Inc.

Major indexes had briefly turned negative after a report from the U.S. Energy Information Administration showed crude oil stockpiles rose more than expected, a bearish sign for demand in the world's largest energy consumer.

Crude oil prices slid 1.1 percent to $79.68 per barrel, and Chevron Corp was the top drag on the Dow, off 1.2 percent to $79.45.

The biggest boost to the Dow came from Merck shares, up 4.2 percent to $39.13.

Credit Suisse upgraded Merck to outperform from neutral, saying the pharmaceutical giant's product pipeline should bring upside, with improved visibility over the next 6-24 months.

The markets are basically marking time until Intel Corp reports its results tomorrow night. That will set the tone for the rest of the week, said Jim Awad, managing director at Zephyr Management in New York .

Until then, you're seeing some minor moves back and forth on such events as the oil data or Merck.

The Dow Jones industrial average <.DJI> rose 28.49 points, or 0.27 percent, to 10,656.06. The Standard & Poor's 500 Index <.SPX> rose 0.31 points, or 0.31 percent, to 1,139.73. The Nasdaq Composite Index <.IXIC> added 3.63 points, or 0.16 percent, to 2,285.98.

Kraft Foods Inc rose 0.7 percent to $29.50 after the company raised its 2009 earnings outlook and after Italy's Ferrero decided not to bid for Cadbury Plc , further strengthening Kraft in its $17 billion takeover bid.

We've had a knee-jerk sell-off to the earnings season so far, but I think Kraft's move may be more representative of corporate America, said David Katz, chief investment officer at Matrix Asset Advisors in New York.

Google's threat to withdraw from China because of censorship and cyber attacks on its systems pushed shares of rival Chinese search engine Baidu Inc up 13 percent to $436.98. Google's shares fell 1.4 percent to $582.03.

Also on Wednesday, the heads of Wall Street's biggest firms defended the lucrative pay practices and huge size of their businesses, but conceded regulatory changes are needed, at the first hearing of a congressional commission investigating the 2008 global financial crisis.

The KBW bank index rose 1.3 percent, a day after investors sold financials on concerns about a potential government levy on banks.

(Editing by Padraic Cassidy)