Oil rose above $94 a barrel as the government raised its forecast for the price of oil this year.
Meanwhile the national average for gasoline dropped and government forecasters said motorists should pay less for gas this summer driving season.
Benchmark oil for May delivery gained 84 cents to finish at $94.20 a barrel. Oil is up $1.50 the past two days after declining by $4.53, or 4.7 percent, last week.
The Energy Department said in its monthly outlook on energy markets that oil should average $94 a barrel in 2013. The outlook is up $2 a barrel from the forecast issued a month ago.
Oil also got a boost from solid gains in U.S. stocks and a drop in the dollar. The Dow Jones industrial average rose about 60 points. And the euro rose to $1.3085 against the dollar, compared with $1.3007 Monday. A weaker dollar makes crude less expensive and more attractive to traders using other currencies.
Drivers received some encouraging news Tuesday. The Energy Department predicted that the average price for a gallon of gas between April and September, when people tend to drive the most, will be $3.63, down 6 cents from a year earlier.
And the current price at the pump dropped by a penny overnight to $3.58 a gallon. That is 35 cents cheaper than at this time last year, when the price was $3.93.
Gasoline prices vacillate, but the big difference between last year and this year suggests the driving season average will end up being much less than the Energy Department predicts. Many analysts don't expect spring prices to surge because refineries are already coming back online after winter maintenance, which will boost gas supplies.
Gasoline prices are notoriously hard to predict, though. Last year the Energy Department forecast a $3.95 average for the driving season. Prices didn't reach that level even for a day last year — they topped out at $3.94 on April 6.
Brent crude, which sets the price of oil used by many U.S. refineries to make gasoline, on Tuesday rose $1.38 to end at $106.15 per barrel on the ICE Futures exchange in London.
Oil investors are waiting for fresh information on U.S. stockpiles of crude and refined products. Data for the week ending April 5 is expected to show an increase of 1.4 million barrels in crude oil stockpiles and a draw of 1.8 million barrels in gasoline stocks, according to a survey of analysts by Platts, the energy information arm of McGraw-Hill Cos.
The Energy Department's Energy Information Administration releases its report Wednesday morning.
In other energy futures trading on the Nymex:
— Wholesale gasoline rose 3 cents to finish at $2.94 per gallon.
— Natural gas fell 7 cents to end at $4.02 per 1,000 cubic feet.
— Heating oil rose 1 cent to finish at $2.96 per gallon.
Pamela Sampson in Bangkok, Pablo Gorondi in Budapest and Jonathan Fahey in New York contributed to this report.