If you can keep your gaze off the hilltops, imagine away the pylons and forget the occasional tractor of an uncertain vintage coughing along the narrow roads, little appears to have changed in the valleys of north-eastern Portugal for decades, perhaps even centuries.

The gnarled alvarinho vines have been relieved of their fruit to make vinho verde, an old woman in black herds her sheep through a hamlet and hungry eagles hover over the fields, scanning the land for lunch.

But look up, past the villages, the clumps of stout ponies and the wolf-haunted forests of pine, oak and eucalyptus, and the harbingers of an environmental revolution are silhouetted against the December sky.

Francisco Ferreira, president of the Portuguese environmental NGO Zero, got wind of what was going on when a friend called that weekend. “He said: ‘I’ve been looking at the graphs and for the past two days we’ve been 100% renewable on electricity production.’ After that, we looked at the data and arrived at 107 hours. We confirmed it with the national energy network, who said we’d had 4.5 days.

“It was great to see that the system was working; to see that we could manage all these renewables even though the circumstances were quite challenging.”

Ferreira and his fellow clean energy advocates hold up those few days as further proof that renewables can reliably replace fossil fuels.

Things may have been helped along by the fact that a good chunk of the 107 hours fell over the weekend – when demand is lower – and by an unusually co-operative Mother Nature, who saw to it that the sun shone and the wind blew favourably.

But supporters of renewable power insist it was down to much more than luck. António Sá da Costa, managing director of the Portuguese renewable energy association Apren, argues it was the result of years of investment and cooperation.

“It was the coming together of three factors, without which none if it would have been possible,” he says. “The first was that we had the power plants in place to take advantage of the natural conditions during that period; second, it was only possible because of the wind, water and sun. The third was that we had the operational grid capability – in terms of both distribution and transportation – to manage this type of situation.”

Yes, the timing was lucky, he adds. But that does not lessen the achievement of linking up hundreds of dispersed renewable power plants instead of taking the easier option of relying on production from one large thermal one.

Or, to put it a little more pithily: “When Cristiano Ronaldo scores a goal, people say it was lucky. No. It wasn’t lucky. It was a lot of training, a lot of preparation and a lot of things. In our case it wasn’t just luck.”

Sá da Costa traces Portugal’s interest in renewable energy back to 1970, when almost all the electricity consumed in the country was from renewable hydropower plants.

However, as the country developed economically, demand outstripped supply, forcing it to look to more conventional sources. It wasn’t until the end of the last century when windfarms appeared in Madeira and, later, on the mainland, that people started to take renewables more seriously.

Portugal’s climate varies between wet and dry years. In wet years, hydropower is the main source of energy, followed by wind and coal. In dry years, however, coal is first, followed by wind and hydro.

According to Apren’s figures, renewable energy has been responsible for 59% of national energy production during a wet 2016, with 41% from fossil fuels. Hydro power has yielded 32%, wind 25%, and solar close to 2%.

Efforts to increase the renewable sector have been hit by Portugal’s economic crisis, which has spooked would-be investors and slowed growth.

Sá de Costa and Ferreira both say the country has to do far more to exploit its thousands of annual hours of sunshine through the creation of more solar farms.

“That’s the real push we need for the future,” says Ferreira. “In the winter, between November and June, hydro and wind can probably guarantee [things]. But from May or June to October and November, we could rely less on wind, and much less on hydro.”

Jorge Seguro Sanches, Portugal’s energy secretary, says the country is on track to see renewable energy accounting for 31% of its energy use by 2020. He also says the government is heavily promoting a solar power programme as part of its plans to reduce dependence on oil imports and foster the development of a sustainable technology hub.

“In the past few years, we have seen a prosperous boom in windfarms,” he says. “Nevertheless, the market nowadays is oriented towards photovoltaic solar energy, as a result of its high technological development and the decline of investment costs. This is a new path for the near future, [and] will guarantee the sustainability of the Portuguese electricity system.”

In the misty valleys of Alto Minho, the windfarm is gradually becoming part of the landscape. Long-horned barrosã cattle graze among the 80-metre-high turbines and seek out their shade in summer. Hunters in pursuit of boar, rabbits and birds still crisscross the hillsides but keep a respectful distance from the technicians who service the plant. Sometimes, the odd wolf is glimpsed far below the sweeping blades.

For Sá da Costa, who has something of the glee of a prophet seeing his predictions coming true, those four and a half days in May were the best possible riposte to the naysayers.

“Now no one can come along and say in good conscience that this is impossible. No. This is possible. Because we did it. And if we did it, it’s also possible in other countries. It’s just a question of finding how to do it.”