Oil held above $40 a barrel on Wednesday after a 4 percent rally in the previous session, as equities gained and investors looked ahead to U.S. inventory data expected to show rising supplies.

Crude's advance on Tuesday stemmed from Wall Street gains sparked by reassuring comments from Fed Chief Ben Bernanke, while President Barack Obama said the United States would emerge stronger from the economic slump.

The equities rally is supporting the market, said Tony Machacek, a broker at Bache Commodities Ltd.

U.S. crude was up 20 cents to $40.16 by 0948 GMT (4:48 a.m. EST). Brent, trading at an atypical premium to U.S. crude because high U.S. inventories are weighing on the U.S. benchmark, was up 1 cent to $42.51.

Oil has fallen from a record high near $150 reached last summer, battered by the recession and weakening global fuel demand which forecasters such as the International Energy Agency predict will contract in 2009.

The price of oil has become closely intertwined with equities, a barometer of economic sentiment, in recent months. European stocks <.FTEU3> were up more than 1 percent on Wednesday, following gains in Asia.

Bernanke signaled on Tuesday that U.S. banks should be able to weather the downturn without being nationalized. But Obama tempered his message of hope with a warning that America faces a day of reckoning for its past excesses.

Attention will focus later in the session on the latest snapshot of oil supplies in the United States.

The U.S. Energy Information Administration releases its weekly inventory report at 1530 GMT (10:30 a.m. EST), which is expected to show that crude stocks probably rose 1.4 million barrels last week.

American Petroleum Institute data on Tuesday showed crude stocks rose 341,000 barrels last week. Oil traders consider the EIA data gives a fuller picture because energy firms are required to respond to its weekly survey.

Also supporting oil were figures earlier this week showing higher-than-expected compliance by the Organization of the Petroleum Exporting Countries to agreed production cuts.

OPEC oil ministers meet to set policy on March 15, and the group is expected to consider deepening its output cuts.

(Reporting by Alex Lawler and Annika Breidthardt; Editing by Keiron Henderson)