* Gas leak causes blast at 645,000 bpd Amuay facility
* Oil minister says fuel exports will not be affected
* Most of those killed were National Guard troops (Recasts, adds details, color, byline)
By Sailu Urribarri and Marianna Parraga
PARAGUANA/CARACAS, Venezuela, Aug 25 (Reuters) - An explosion tore through Venezuela's biggest refinery on Saturday, killing at least 39 people, wounding dozens and halting operations at the facility in the worst accident to hit the OPEC nation's oil industry.
Energy Minister Rafael Ramirez told Reuters no production units at the Amuay refinery were affected and that there were no plans to halt exports, a sign that the incident will likely have little impact on fuel prices.
Photographs taken shortly after the pre-dawn blast showed wrecked vehicles, flattened fences and giant storage tanks buckling and crumpling as flames lit the night sky. A National Guard building in the area was shattered and officials said a 10-year-old child was among the dead.
A gas leak caused the explosion and most of those killed were National Guard troops who were providing security for the 645,000 barrel-per-day (bpd) facility, Ramirez said, adding that the fire was under control.
"There was a National Guard barracks near the explosion. ... The installation was too close to the operations," Ramirez told Reuters in an exclusive telephone interview, adding that production could resume at Amuay within two days at most.
"We need to boost production at other refineries and look for floating storage near the complex," he said.
The incident follows repeated accidents and outages during the last decade across installations run by state oil company PDVSA that have limited output and crimped expansion plans.
Amuay has partially shut operations at least twice this year due to a small fire and the failure of a cooling unit.
Those problems have spurred accusations of inept management by the government of President Hugo Chavez, who is running for re-election on Oct. 7.
Acrimony over the explosion could spill over into an already bitter campaign, but s unlikely to overtake larger political concerns such as crime and the economy.
"I want to convey the deepest pain that I've felt in my heart and soul since I started to get information about this tragedy," Chavez said in phone call to state TV. He declared three days of mourning.
FIRE UNDER CONTROL
Venezuela has traditionally been a big supplier of fuel to the United States and the Caribbean, but refinery shutdowns have become so common that they rarely affect market prices.
Traders told Reuters the docks at the refinery were shut, and tankers were anchored offshore waiting. They said this would cause delays to some of the country's exports.
The explosion broke windows at homes in the area, a peninsula in the Caribbean sea in western Venezuela, as well as at Amuay's main administrative building.
The blast was also felt out at sea in the Paraguana bay, where some crew members on moored tankers were knocked off their feet by the shockwave, one shipping source said.
Ramirez said the fire that started after the explosion had only affected nine storage tanks holding mostly crude oil and some processed fuels including naphtha.
Officials said two tanks were still burning off residual fuel, and a Reuters witness at the scene said large black clouds of smoke still hung above the area.
Ramirez said existing fuel stocks around the country were sufficient to guarantee 10 days of exports and local sales. PDVSA has no plans to invoke force majeure, he said, which lets companies stop shipments due to accidents or extreme weather.
Amuay, together with a neighboring facility, forms part of the Paraguana Refining Center, the second-biggest refinery complex in the world, with an overall capacity of 955,000 bpd.
In 2010, there was a massive fire at a PDVSA fuel terminal on the Caribbean island of Bonaire, then a blaze at a dock at the Paraguana complex that halted shipping for four days.
Also in 2010, a natural gas exploration rig, the Aban Pearl, sank in the Caribbean. All 95 workers were rescued safely. (Additional reporting by Deisy Buitrago, Marianna Parraga and Andrew Cawthorne in Caracas; Writing by Daniel Wallis; Editing by Kieran Murray, Sandra Maler and Todd Eastham)