A large fire at an electrical substation caused the loss of power to up to 25,000 homes in Staffordshire.
Several fire appliances were sent to the site, behind a petrol station in Eastern Avenue in Lichfield, at about 20:50 GMT on Wednesday.
Western Power Distribution said the power cut affected Lichfield and surrounding areas for several hours, with supplies restored at 05:00 GMT.
The firm originally thought the power would not be restored until 10:00.
An investigation into the cause of the blaze, which broke out close to the West Coast Mainline, is under way.
'Stayed on duty'
Teams from the Environment Agency, Lichfield District Council, Staffordshire County Council and Network Rail were involved as well as the emergency services, Staffordshire Police said.
The blaze was brought under control and subsequently put out at about 00:30 GMT, the fire service said.
Graham Mills, of Staffordshire Fire and Rescue, said crews remained at the scene overnight because of the highly combustible materials within the substation and to ensure the fire did not reignite.
Nearby residents were advised to keep windows closed during the blaze.
The fire forced Staffordshire Police to shut Eastern Avenue in both directions.
David Bailey, from the force, said "We worked to support the community and ensure the safety of those working to tackle the fire and those affected by the power cut.
"Officers stayed on duty to support the operation and direct those affected. Thankfully no evacuations have been necessary"
Residents were warned that there would be some additional power cuts as supplies were restored.