Wind energy provided more than half of Spain's total electricity needs for several hours over the weekend as the country set a new national record for wind-generated power.

With high winds gusting across much of the country, Spain's huge network of windfarms jointly poured the equivalent of 11 nuclear power stations' worth of electricity into the national grid.

At one stage on Sunday morning, the country's wind farms were able to cover 53% of total electricity demand – a new record in a country that boasts the world's third largest array of wind turbines, after the United States and Germany.

For more than five hours on Sunday morning output from wind power was providing more than half of the electricity being used. At their peak, wind farms were generating 11.5 gigawatts, or two-thirds of their theoretical maximum capacity of almost 18GW.

The new record, which beat a 44 % level set earlier last week, came as strong winds battered the Iberian peninsula.

The massive output of wind turbines meant the Spanish grid had more electricity than was needed over the weekend. In previous years similar weather has forced windfarms to turn turbines off but now the spare electricity is exported or used by hydroelectric plants to pump water back into their dams — effectively storing the electricity for future use.

José Donoso, head of the Spanish Wind Energy Association, recalled that just five years ago critics had claimed the grid could never cope with more than 14% of its supply from wind.

"We think that we can keep growing and go from the present 17GW megawatts to reach 40GW in 2020," he told El País newspaper.

Windfarms have this month outperformed other forms of electricity generation in Spain, beating gas into second place and producing 80% more than the country's nuclear plants.

Experts estimate that by the end of the year, Spain will have provided a quarter of its energy needs with renewables, with wind leading the way, followed by hydroelectric power and solar energy.