On Monday, a huge power cut struck much of Spain and Portugal, causing widespread chaos and disruption.
The power outages left millions of people out of power, and the internet and telephone networks were reduced.
Trains were cancelled and evacuated in certain areas and traffic lights stopped working due to delays at the airport.
With shops, houses and restaurants falling into darkness - some people stuck in elevators - Spain's electricity network said in mid-afternoon that it could take several hours to restore power.
Spanish political leaders say the cause of the interference is still unknown, but there is no indication of a cyber attack.
The first report of a power outage Its impact escalated rapidly starting around Monday (10:00 GMT).
As the scale of the destruction became clear, residents in Madrid were warned to stay away from the roads and not to call emergency services unless “really urgent.”
A Spanish operator said the power repair will take up to 10 hours, while Portugal's power company Ren said it could take a week to restore full strength.
When the card was paid, the queue formed on the cash machine was affected by the power outage, and some gas stations were reported to be closed.
News agencies reported that Spanish media reported that some hospitals had implemented emergency plans, including stopping routine work.
By the evening and after a few hours of power outages, residents in some parts of the country reported that the lights had been restored.
Spanish grid operators say power is being restored “in the north, south and several areas west of the (Iberian) peninsula.”
Authorities in Spain and Portugal are still trying to figure out what led to the cuts.
"There are no signs of cyber attacks yet," said Antonio Costa, president of the European Council.
As panic spread earlier in the day, residents in Madrid were warned to stay away from the road.
In the video on social media, the mayor of the Spanish capital, José Luis Martínez-Almeida, told residents "keep their movements at an absolute minimum and stay where they are if possible. We want to keep all the roads clear."
He said people can only call emergency services in a “really urgent” situation.
“If the emergency call is not answered, go to the police and the fire department in person and they will try to deal with all emergencies.”
The country's nuclear power plants will automatically stop when a power outage hits, and Spanish oil company Moeve said it has stopped operations at its refineries.
Flights have also been affected, delayed and cancelled at some airports. EasyJet said it is causing some disruption to operations in Lisbon and Madrid. It says the situation is “smooth” and tells the client to check local advice.
Aviation data company Cirium said 96 flights from Portugal were cancelled.
The company has been severely affected. Some IKEA branches in Spain switch to backup generators and prevent customers from entering their stores.
Madrid Open Tennis Organizers have decided to cancel Monday's event.
Elsewhere, Andorra and parts of France were also attacked, but the Balearic and Canary Islands were not affected.