More than 50 firefighters worked through the night to contain a blaze at a commercial warehouse in Barwell Lane in Gosport, which housed a number of large generators and lithium battery units.
The alarm was raised at 7.30pm on Saturday, with local residents advised to keep their windows and doors shut to protect from thick smoke affecting the area.
Two police officers were taken to the Queen Alexandra Hospital as a precautionary measure following smoke inhalation.
Crews from Cosham, Fareham, Portchester, Gosport, Southsea, Eastleigh and Beaulieu attended along with the incident command unit and environmental protection units from Romsey and Alton.
Thirty breathing apparatus, two hose reel jets, four main jets, and an aerial ladder platform were used.
Hampshire and Isle of Wight Fire and Rescue Service Station Manager, Rob Sansome, said: "This was a large and complex fire involving a single-storey warehouse.
"Firefighters worked through the night to bring the incident under control and prevent the fire from escalating."
The fire was put out by 12.30am but crews stayed on scene to dampen down and monitor.
The cause of the fire will now be investigated.