MADRID - Spain's top energy official said on Monday the country had enough spare generating capacity to phase out nuclear power stations in the medium term, in line with government policy.

In recent years, Spain has subsidized renewable energy in order to cut its heavy dependence on fuel imports and reduce greenhouse gas emissions. It is now the world's third-biggest producer of wind power and the second-biggest of solar.

Nuclear power is unpopular in Spain and both major political parties ruled out building new plants in last year's elections.

Investing in nuclear energy makes sense when there are problems in ensuring supply. In '99 or 2000 that was the case with our energy margin, Energy Secretary Pedro Marin told a conference on energy policy.

We now have substantial spare generation capacity, a very broad demand structure, without any problem, he added.

Spain has an installed generating capacity of some 90,000 megawatts and record demand of 43,000 MW, and has been a net exporter of power for several years.

A Citibank research note last week estimated Spanish electricity demand would grow by a slow 2 percent a year as of 2011, and power prices would be depressed for years by more renewables production and additional gas supplies.

Marin spoke in response to International Energy Agency chief Nobuo Tanaka, who said nuclear power helped boost energy independence and reduce carbon emissions.

Phasing out may not help the current challenge that Spain is facing with energy security and climate change, Tanaka said at the same conference.

STILL A MAJOR PRODUCER

Although Spain is bucking a trend amongst several European countries, which are mulling over building new nuclear plants, Marin noted Spain already had more nuclear capacity than most of its neighbors.

Not only are we on top now, but will remain so for the next five or 10 years because long-term investments are needed to build up a broad nuclear infrastructure, Marin told a conference at the Industry Ministry.

Spain's eight remaining nuclear plants are designed to produce up to 7,800 megawatts of power between them. They generate about 54,000 gigawatt-hours a year, or some 20 percent of total demand for electricity.

The government has ordered the 38-year-old 460 MW Garona plant to close in 2013, but the rest will not reach the end of their working lives until 2021 at the earliest.

National grid operator REE has said it cannot yet balance intermittent supply from renewable sources without a steady baseload generated by nuclear plants.

(Editing by Sue Thomas)