Oil edged higher on Wednesday as stock market rises outweighed a bearish weekly U.S. crude oil inventory report.

The Energy Information Administration's weekly inventory report showed a 5.6-million-barrel rise in U.S. crude stocks, to 366.7 million barrels, the highest level since September 1990.

A Reuters poll of analysts had expected a 1.9-million-barrel build.

U.S. crude for May delivery rose 4 cents to $49.45 a barrel by 17:18 GMT (1:18 p.m. EDT), off a session high of $50.79.

ICE Brent crude was 13 cents higher at $52.09.

Crude futures have turned higher, despite crude supply rising to a near 19-year high, as oil traders are looking at the stock market, said Phil Flynn, analyst, Alaron Trading in Chicago. It seems that crude supplies here have become secondary to the larger economic picture.

The Dow Jones industrial average held in positive territory on Wednesday, helped by gains in Procter & Gamble, while the Standard & Poors 500 Index bounced into the positive in early afternoon trade.

Oil prices have tumbled nearly $100 per barrel since last July, as the global recession dented oil demand, but they have recovered in recent months from a low of $32.40 in December.

A rally in equity markets this month, in the hope that the world economic outlook might be brightening, has helped boost oil prices, despite its weak supply/demand fundamentals.

We still expect the U.S. stock market to be the intermediate price driver for most commodity complexes over the next few weeks, Edward Meir of MF Global said in a research note.

However, gloomy economic indicators remain, with Federal Reserve Data showing U.S. industrial output shrank more than expected in March.

The Organization of the Petroleum Exporting Countries said Wednesday that world oil demand would fall by 1.37 million barrels per day in 2009, up from its previous forecast for a fall of 1.01 million bpd.

In the coming months, the market is expected to remain under pressure from uncertainties in the economic outlook, demand deterioration and the substantial supply overhang, OPEC said.

Both the International Energy Agency and the U.S. government agency EIA have also just reduced their global demand forecasts.

In its monthly outlook released on Tuesday, the EIA cut its 2009 world oil demand forecast by 180,000 barrels per day to just over 84 million bpd.

(Additional reporting by Robert Gibbons and Gene Ramos in New York and Jane Merriman in London; Editing by Christian Wiessner)