At least 21 people have died and scores more have been injured in an explosion at a fireworks factory in a military complex in northern Vietnam, an army official said Saturday.

Plumes of black smoke billowed from the Z121 military facility, around 120 kilometres (75 miles) north of Hanoi, as fireworks exploded uncontrollably for several hours, witnesses said.

"Twenty-one people are dead and 98 others are injured -- most of them have sustained burns," a military rescue official told AFP by phone, requesting anonymity and raising an earlier toll of seven dead.

Local hospitals received many of the victims, some with horrific burns. The most critical cases were moved to a specialist burns centre on the outskirts of Hanoi.

"I couldn't recognise my daughter, she was burned from her face to the soles of her feet," one woman told state media. "She was pregnant, she couldn't escape the explosion quick enough."

Images posted on Vietnamese blogs showed charred frames of motorcycles, and nearby houses with roofs ripped off and windows blown in by the force of the explosions.

Some 2,000 local residents were also evacuated.

"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 first blast was at 7:55 am -- and then there were continuous explosions for some hours," Phi Xuan Trung, chairman of the local Khai Xuan commune, told the VNExpress news site.

"There was a strong smell of gunpowder, the ground was shaking many kilometres away," he added.

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

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

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

One local resident told AFP that locals have fled to the Viet Tri township, about 40 kilometres away.

"We have received warnings from authorities that there could be further explosions which could be very destructive," he said, speaking on condition of anonymity.

In 2010, fireworks being prepared at Hanoi's My Dinh stadium for use in the city's 1,000th anniversary celebrations exploded, killing three foreigners and one Vietnamese national.

That explosion was blamed on carelessness during the transport of two containers of fireworks, local media reported at the time.

Fireworks are frequently used to see in the western and Vietnamese New Year, or on special occasions such as the country's national day in September.

Handmade firecrackers were traditionally used as a symbol of good luck to celebrate the Lunar New Year -- known locally as Tet -- and at weddings.

But, in 1994, the government banned the production and use of all firecrackers nationwide for safety reasons, changing instead to fireworks -- which are produced only in state-approved facilities. -- AFP