Oil prices climbed toward $51 per barrel on Wednesday as optimism that the U.S. recession was easing boosted markets and raised expectations of a rebound in energy demand from the world's largest consumer.

A U.S. government report showing a sharp decline in gasoline stockpiles last week added to oil's gains, sparking concern that inventories could be tight once peak summer driving demand kicks in.

U.S. crude oil for June delivery rose $1.05 to settle at $50.97 a barrel. London Brent crude rose 95 cents to $50.94 a barrel.

The gains came amid a rise of about 3 percent in U.S. stock markets <.DJI><.SPX> tied to hopes the recession may be abating, even as a report showed a dismal 6.1 percent contraction in the U.S. economy in the first three months of the year.

The U.S. Federal Reserve said Wednesday the pace of deterioration in the U.S. economy appeared to be slowing.

Analysts said the oil market also found support from a U.S. Energy Information Administration report showing a surprise 4.7-million-barrel decline in nationwide gasoline inventories that eliminated a supply surplus heading into peak driving season.

I think the gasoline draw is what caught everybody's eye. Nobody expected a draw of that magnitude, said Addison Armstrong, director of market research at Tradition Energy in Stamford, Connecticut.

The EIA's weekly report also showed a 4.1-million-barrel increase in crude oil stockpiles last week, bringing inventories to a fresh 19-year high.

The gradual global spread of swine flu, with the first U.S. death confirmed from the H1N1 strain, also failed to dent the oil market Wednesday -- though prices for jet fuel were generally lower on concerns about the impact the health emergency would have on air travel.

We have had a high correlation between stock markets and oil over the last few weeks and when equities go up, so do oil and other commodities, said Frank Schallenberger, head of commodities research at Landesbank in Stuttgart.

REUTERS DEMAND POLL

Oil prices remain about $100 below peaks hit last July as the global economic downturn shrank global energy consumption levels for the first time in a quarter century.

Royal Dutch Shell Chief Financial Officer Peter Voser said oil prices were unlikely to rise significantly in the next 12 to 18 months because of the economic weakness.

It will take time for the economy to recover, and hence the oil and gas price will be affected by that, Voser said.

A Reuters' poll of 11 analysts, banks and industry groups forecast world oil demand would fall this year by much more than previously expected, as growth stalls in emerging powerhouses China and India and fuel consumption declines in the developed world.

The poll showed oil use declining by an average of 1.56 million barrels per day (bpd) in 2009 to 84.10 million bpd. Estimates see oil growth reemerging in 2010.

(Reporting by Richard Valdmanis; Editing by David Gregorio)