The sulphur fire at a Napier Fertiliser works was resolved this evening.
Hawke's Bay fire area commander Ken Cooper said the fire was contained at about 6pm but crew had stayed on site to decontaminate equipment.
There was no longer a risk to the public so the roads had been re-opened and residents were able to go back to their homes.
Fire crews dealt to the blaze this afternoon with concerns about a large amount of sulphur in the building.
Central fire service communications shift manager Mike Wanoa said they had received a call about 2.18pm from Ravensdown in Awatoto, advising them a building had caught fire.
Fire assistant area commander Nigel Hall said the "smouldering fire" was believed to have started in the conveyor belt in the second shed.
"We are unsure what caused it at this stage but the product is susceptible to spontaneous ignition at low temperatures."
Mr Hall said there was about 800 tons of sulphur in the building.
Fire crews were only able to use low pressure deliveries to put out the fire, as there was a possibility of a dust explosion due to the large amounts of sulphur.
"As we add water there is more of a chance of the sulphur going in to a dust cloud and exploding."
Mr Hall said they had to use water to extinguish the fire so they used spray rather than jets.
The fire service were on their "fifth alarm" so had 12 appliances and 60 fire crew fighting the blaze at its peak.
Mr Hall said the nature of the smoke had caused the residents living in the three roads surrounding the factory to be evacuated.
Police safety team sergeant Greg Simmons said these residents came from McLeod Rd, Waitangi Rd and Awatoto Rd.
Health officials had urged people living near Awatoto or downwind of the factory to close windows and doors and to turn off air-conditioning units.
Medical Officer of Health Nick Jones said smoke from the fire and the burning sulphur could affect people who had breathing issues like asthma or bronchitis and make their conditions worse.
Dr Jones said anyone experiencing breathing difficulties should get medical help.
State Highway Two had been closed from Waitangi Rd to Farndon Rd due to the hazardous event and to allow fire and police facilities immediate access.
Mr Simmons said police also patrolled the cycleways to stop any cyclists filtering in to the surrounding area.