* U.S. gasoline at two-year high above $2 a gallon
* U.S. government taps Strategic Petroleum Reserve
* Storm impact to hit crude throughput, boost inventories
* Harvey's energy impact interactive: http://tmsnrt.rs/2xzsKWz (New throughout, updates prices, market activity, comments, adds crude outages)
NEW YORK, Aug 31 (Reuters) - Gasoline futures surged more than 13 percent on Thursday, and crude oil settled nearly 3 percent higher, as almost a quarter of U.S. refining capacity remained offline and traders scrambled to reroute millions of barrels of fuel.
U.S. gasoline futures have rallied more than 28 percent from the previous week to a two-year high above $2 a gallon, buoyed by fears of a fuel shortage days ahead of the U.S. Labor Day weekend's traditional surge in driving. Gasoline settled up 25.52 cents, or 13.54 percent, at $2.1399.
Hurricane Harvey, which brought record flooding to the U.S. oil heartland of Texas and killed at least 35 people, has paralyzed at least 4.4 million barrels per day (bpd) of refining capacity, according to company reports and Reuters estimates.
The U.S. Department of the Interior's Bureau of Safety and Environmental Enforcement said that roughly 13.5 percent of oil production in the Gulf of Mexico was also shut in on Thursday.
The U.S. government tapped its strategic oil reserves for the first time in five years on Thursday, releasing 1 million barrels of crude to a working refinery in Louisiana. Traders were also scrambling to redirect fuel to the United States.
U.S. West Texas Intermediate (WTI) crude futures settled $1.27 higher at $47.23 per barrel, up 2.76 percent. It remained on track to close August down almost 6 percent, the steepest monthly loss since March.
International benchmark Brent crude settled $1.52 higher, or 2.99 percent, at $52.38 a barrel. It had fallen by just over 2 percent in the previous session.
"The market has turned in reverse pretty sharply," said Gene McGillian, manager of market research at Tradition Energy. "You do have some signs of rebalancing, regardless of Harvey."
On Wednesday, oil prices fell despite a weekly drop in closely watched U.S. commercial crude stocks of 5.39 million barrels. Crude inventories are 14.5 percent below record levels hit in March. <C-STK-T-EIA>
OPEC output this month also fell 170,000 bpd from a 2017 high, a Reuters survey found, as renewed unrest cut supplies in Libya and other members stepped up compliance with a production-cutting deal
Analysts called the status of U.S. refineries a key to oil prices.
"The disruptions in recent days may delay the ongoing global crude oil rebalancing process," Bank of America Merrill Lynch said in a note.
Analysts at Goldman Sachs and Stifel said U.S. outages would probably last several months but it was difficult to estimate the exact damage. Others said higher gasoline prices might prompt operational refineries to delay typical September seasonal maintenance.
"Refineries outside the affected area may delay maintenance to benefit from high processing margins," said Commerzbank oil analyst Carsten Fritsch. "Hence, the negative impact on crude oil demand and oil product supply might be less severe than feared."
Shrinking crude stocks and expectations for rising growth in global demand meant analysts in a monthly Reuters poll raised their oil price forecasts for the first time in six months.
(Additional reporting by Karolin Schaps in Amsterdam and Henning Gloystein in Singapore; Editing by David Goodman and David Gregorio)