* Hurricane Harvey to hit central Texas late Fri-early Sat
* Could be most powerful storm to hit U.S. mainland since 2005
* Two refineries shut in Corpus Christi, others consider closing
* Nearly 10 pct of U.S. Gulf offshore crude output shut (Adds graphic)
SAN ANTONIO, Aug 24 (Reuters) - U.S. gasoline prices surged to a three-week high on Thursday as Hurricane Harvey moved across the Gulf of Mexico and threatened to strike the heart of the country's oil refining industry when it comes ashore in Texas this weekend.
Communities in the path of the quickly strengthening storm began evacuating and energy firms shut refineries and offshore oil and gas platforms. Just under 10 percent of offshore U.S. Gulf of Mexico crude output capacity was shut down on Thursday, government data showed.
Harvey is forecast to come ashore as a Category 3 hurricane, the U.S. National Hurricane Center said, the third most powerful on the SaffirSimpson scale, which would make it the strongest to hit the U.S. mainland in 12 years.
Such storms pack maximum sustained winds of up to 129 miles (208 km) per hour and Harvey would be the first Category 3 hurricane to make land in the United States since Hurricane Wilma struck Florida in 2005.
The NHC expects Harvey to move slowly over Texas and linger over the state for days, dumping as much 30 inches (76.2 cm) of rain on some areas.
"With this system's intensity and slow motion, it is the worst of both worlds," said John Tharp, a forecaster with Weather Decision Technologies in Norman, Oklahoma. "There will be major impacts along the coast and inland with periods of prolonged rain."
Harvey will cause a storm surge that will flood parts of the Texas coast as it makes landfall, the NHC said in an advisory.
The mayor of Texas coastal city Corpus Christi warned on Wednesday that flooding was his biggest concern and urged people to evacuate from low-lying areas.
"I hope people will listen to forecasters when they say 'beware of flash floods,"' Mayor Joe McComb said. "Flash floods can come quickly, and they can be deadly."
The city, a major oil refining center, has not issued any evacuation orders, he told reporters at a news conference, but its emergency operations center has been activated.
The NHC expects the storm to come ashore along the central Texas coast, an area that includes Corpus Christi and Houston, home to some of the biggest refineries in the country.
More than 45 percent of the country's refining capacity is along the U.S. Gulf Coast, and nearly a fifth of the nation's crude oil is produced offshore in the region.
Harvey has already disrupted U.S. oil supplies in the region.
Two oil refineries in Corpus Christi were shutting down ahead of the storm, and concern that Harvey could cause shortages in fuel supply drove benchmark gasoline prices to a three-week high.
One other refinery reduced output and other were considering shutting.
Prices for gasoline in spot physical markets on the Gulf Coast rose even more, hitting a one-year high.
Profit margins for refineries producing gasoline rose by over 12 percent, on course for their biggest daily percentage gain in six months, according to Reuters data.
The two refineries that have shut have combined capacity to refine more than 450,000 barrels per day of crude.
Energy companies including Royal Dutch Shell, Anadarko Petroleum and Exxon Mobil have evacuated staff from offshore oil and gas platforms in the storm's path.
Around 167,000 barrels per day, or 9.6 percent, of crude output capacity in the Gulf was shut, the U.S. government said.
The storm could also bring flooding to inland shale oil fields in Texas that pump millions of barrels per day of crude.
Norwegian oil firm Statoil ASA said on Thursday it would evacuate staff from the Eagle Ford shale region in South Texas. The firm will close wells if there is a flooding risk, a spokesman said.
Texas Governor Greg Abbott declared a state of disaster on Wednesday for 30 counties, authorizing the use of state resources to prepare for the storm.
Coastal cities and counties distributed sandbags to residents as some businesses boarded up windows, and residents flocked to grocery stores to stock up on supplies, local media reported.
Texas A&M University-Corpus Christi issued a mandatory evacuation to all students who live on campus and canceled events.
(Additional reporting by Jarrett Renshaw and Devika Krishna Kumar in NEW YORK, Erwin Seba and Ernest Scheyder in HOUSTON, Brendan O'Brien in Milwaukee; Writing by Simon Webb; Editing by Meredith Mazzilli)