Oil rose on Thursday as a fall in the dollar and stock market gains outweighed rising U.S. inventories.

U.S. crude settled 77 cents higher at $49.62 a barrel, after earlier trading down to $48.37. London Brent crude traded up 30 cents to settle at $50.11 a barrel.

The euro gained against the dollar as demand rose on better-than-expected earnings results from banks and as data on euro zone industrial new orders showed a smaller-than-expected decrease.

A falling dollar can boost the appeal of oil and commodities to investors as an inflation hedge.

The European purchasing number gave the dollar some weakness, said Phil Flynn, analyst for Alaron Trading in Chicago, adding: That's keeping us held in there today.

Oil's gains came despite swelling U.S. crude inventories, which hit a fresh 19-year high last week, according to U.S. government data released on Wednesday.

Further support for crude U.S. stocks rose in afternoon trade as a climb in bank shares helped offset disappointing economic data and outlooks from economic bellwethers, including UPS.

Crude futures gained here as the equities market rose back up, said Tom Knight, trader for Truman Arnold in Texarkana, Texas.

Crude futures were trading sideways, and the late rise on Wall Street pretty much encapsulates what lifted crude today.

The pace of sales of existing homes in the United States fell 3.0 percent in March to a lower-than-expected annual rate of 4.57 million units, the National Association of Realtors said on Thursday.

The number of people claiming benefits after drawing an initial week of aid in the United States vaulted to another record high in early April, for the 14th consecutive week, the Labor Department said.

The slumping economy has clipped fuel demand and dragged oil prices off record highs over $147 a barrel hit in July.

(Reporting by Matthew Robinson, Robert Gibbons, and Gene Ramos in New York, Christopher Johnson, Alex Lawler and Barbara Lewis in London and Chua Baizhen in Singapore; Editing by Christian Wiessner)