An explosion at Vietnam's military-run fireworks factory has killed at least 21 people in the country's north.

The incident also left at least 98 people injured, prompting the evacuation of about 2,000 people living near the area, a military rescue official told the AFP news agency on condition of anonymity as he was not authorised to speak to the media.

Residents in Thanh Ba district, where the complex is located, said they felt the ground shake during the powerful repeated explosions.

"After the first explosion, my house was shaking and the door smashed open," Nguyen Nhu Quynh, a witness, told the online newspaper VNExpress.

A local police officer told the Associated Press news agency that the explosion could be heard 10km away and it levelled some houses and shattered glass windows in others. He spoke anonymously because he was not authorised to speak to the media.

"The fire has now been brought under control," a police official in Phu Tho province told AFP, adding that an investigation into the cause of the accident had been opened.

The factory is the only facility in Vietnam that produces fireworks to be used for Lunar New Year festivals and other major public events.

The unit employs some 300 workers, mostly women, according VNExpress.

Major-General Le Quang Dai told the paper that only several dozens of the employees were working at the time of the explosion, because it was Saturday.

Authorities had tried to isolate the explosion to prevent it from two explosives warehouses nearby, he said.

Loudspeakers urged people within 15 kilometres of the military facility to leave the area.

Source: Agencies