* Harvey knocked out almost 1/4 of U.S. refining capacity
* U.S. oil production also hit, albeit to lesser degree
* But signs point to less-than-feared infrastructure damage
* Markets nervously eye North Korea after nuclear test (Re-leads, adds chart, updates prices)
SINGAPORE, Sept 4 (Reuters) - Oil markets were volatile on Monday, with U.S. crude rising on production shutdowns while international Brent was pulled down by a flight into gold futures following a powerful North Korean nuclear test explosion.
Meanwhile, U.S. gasoline prices slumped back from a spike after the release of emergency fuel stocks and on signs that the damage from Hurricane Harvey to the Gulf coast energy infrastructure was not as bad as initially feared.
U.S. West Texas Intermediate (WTI) crude futures were at $47.42 barrel at 0411 GMT, 13 cents above their last settlement.
Traders said that this price rise was a result of crude production outages following Hurricane Harvey.
About 5.5 percent of the U.S. Gulf of Mexico's oil production, or 96,000 barrels of daily output, remained shut on Sunday, the federal Bureau of Safety and Environmental Enforcement said.
At the same time, refineries that use crude to make fuel were gradually starting up again, along with the pipelines transporting products.
"Traders are hopeful that crude backlogs will be cleared," said Jeffrey Halley, senior market analyst at futures brokerage OANDA.
Still, many analysts say it could take months before the U.S. petroleum industry fully recovers from Harvey, and Texas Governor Greg Abbott estimated damage at $150 billion to $180 billion, calling it more costly than Hurricanes Katrina or Sandy, which hit New Orleans in 2005 and New York in 2012.
Storm Harvey made landfall along the Gulf coast of Texas and Louisiana last week, knocking out almost a quarter of the entire U.S. refining capacity, causing a price spike and supply gap for fuels like gasoline, which traders around the world have been scrambling to fill.
Outside the United States, markets were nervously eyeing developments in North Korea, where the military conducted its sixth and most powerful nuclear test over the weekend. Pyongyang said it had tested an advanced hydrogen bomb for a long-range missile, prompting the threat of a "massive" military response from the United States if it or its allies were threatened.
This put downward pressure on international Brent crude as traders moved money out of oil - seen as high-risk markets - into gold futures, traditionally viewed as a safe haven for investors
Brent was at $52.54 per barrel, down 21 cents, or 0.4 percent from the last close.
(Reporting by Henning Gloystein; Editing by Joseph Radford and Kenneth Maxwell)