A raging fire leapt from hilltop to hilltop in Chile's picturesque port city of Valparaiso and stubbornly burned out of control in places more than 24 hours later, killing 12 people and destroying at least 2,000 homes.

More than 10,000 people were evacuated, including more than 200 women inmates at a prison.

With hot dry winds stoking the embers, some of the fires broke out again and were burning out of control as a second night fell.

The blaze began on Saturday afternoon local time in a forested ravine next to ramshackle housing on one of the city's 42 hilltops, and spread quickly as hot ash rained down over wooden houses and narrow streets that lack municipal water systems.

Electricity failed as the fire grew, with towering, sparking flames turning the night sky orange over a darkening, destroyed horizon.

Eventually, neighbourhoods on six hilltops were reduced to ashes, including one hill just several blocks from Chile's parliament building. And flames broke out again on at least two of those hills, burning out of control and threatening to consume other neighbourhoods.

"It's a tremendous tragedy. This could be the worst fire in the city's history," President Michelle Bachelet said as firefighters contained most of the blazes, mobilising 20 helicopters and planes to drop water on hotspots.

The fire destroyed at least 2,000 houses and authorities warned that the death and damage toll could rise once the fires cooled enough for them to search for bodies.

More than 500 people were treated at hospitals, mostly for smoke inhalation.

Patricio Bustos, who directs the national forensics service, said DNA tests would be needed to identify some of the remains.

It was already the worst fire to hit the picturesque seaside city of 250,000 people since 1953, when 50 people were killed and every structure was destroyed on several of the city's hills.

While the fires were contained to the hills, Ms Bachelet declared the entire city a catastrophe zone, putting Chile's military in charge of maintaining order. While 1,250 firefighters, police and forest rangers battled the blaze, 2,000 sailors in combat gear patrolled streets to maintain order and prevent looting.

"The people of Valparaiso have courage, have strength and they aren't alone," Ms Bachelet said.

Valparaiso has a vibrant port and is home to Chile's national legislature, but it owes its status as a Unesco World Heritage Site to its colourful architecture, with neighbourhoods hugging hills so steep that people use staircases and cable cars to reach their homes.

Unfortunately, many homes in densely-populated poorer areas above the city center have been built without proper water or natural gas supplies, and many streets are too narrow for fire trucks to enter.

"We are too vulnerable as a city. We have been the builders and architects of our own danger," Valparaiso Mayor Jorge Castro said.

Chile's emergency response system generated automatic phone calls to each house in danger as the mandatory evacuations expanded. Many people stuffed their cars with possessions after getting these calls, and streets quickly became impassible.

Water trucks and firefighters were stuck downhill as people abandoned their vehicles and ran. Some carried television sets and others took canisters of natural gas, fearing an explosion if flames reached their homes.

With so many hills on fire, water was in short supply even in established neighbourhoods downhill. A water emergency was declared, cutting off non-essential supplies.

Shelters were overflowing. Ms Bachelet toured some and said she would meet each of her ministers to hear what they were doing in response. "The situation is dramatic, but help is already arriving," she said.

Maria Elizabeth Diaz, eight months' pregnant and trying to rest with her two sons in a shelter set up in Valparaiso's Greek School, said she had been hesitant to flee her home in Cerro Las Canas when she first learned that the hilltop above her was on fire.

"I didn't want to move because I was afraid they'd rob me, but I had to flee when I saw the fire was coming down the hill," she said. "I lost everything. Now I've been ordered to rest because I was having contractions. My little one knows that he can't arrive quite yet."

Another evacuee, Erica Gonzalez, 74, said her daughter and some neighbours had to carry her to safety because the fire burned her wheelchair.

"I was left in the street. My house was completely burned, and that of my daughter a block away," she said, visibly upset as she hugged a grandchild.

Some people returned home to discover total destruction. "It's frightening, everything is burned," said Francisca Granados, who had spent the night with friends in the neighbouring city of Vina del Mar.

Thick clouds of smoke surrounded the city prison, where nine pregnant inmates were transferred to a detention centre in the nearby city of Quillota. Another 204 women inmates were being evacuated to a sports arena. More than 2,700 men will remain at the prison for now.