Firefighters were having difficulty combating the blaze because of the topography of the city, which is surrounded by dozens of steep hills where most people live.
"This is the worst disaster I have seen," regional governor Ricardo Bravo said. "Now we fear that the fire will spread to the center of the city, which would increase the severity of the emergency."
President Michelle Bachelet has declared the city of 250,000 people a catastrophe zone, which puts the armed forces in charge of maintaining order and evacuating thousands of residents affected by the smoke and flames. Authorities have evacuated an estimated 5,000 people, a figure that is expected to rise.
Interior Minister Rodrigo Penailillo said the fire has caused the deaths of four people - three men and a woman.
Thick clouds of smoke surrounded the city's prison and nine pregnant inmates were transferred to a detention facility in the nearby city of Quillota. Prison authorities were evacuating another 204 female inmates to a sports arena. The more than 2,700 male inmates will remain at the prison for the time being, prison guard commander Tulio Arce said.
Valparaiso Mayor Jorge Castro said "at least 500 homes have been destroyed by the fire." He said shelters for those forced to flee have been set up. The city was experiencing cuts to the electricity supply, he said.
While firefighters, police and forest rangers battled the blaze, Chilean marines in combat gear patrolled streets in the city to maintain order and prevent looting.
The fire started Saturday afternoon in hills on the edge of the city and spread rapidly because of strong winds. Hot ash rained down on the city early Sunday, causing respiratory problems among the population, especially children and the elderly.
Valparaiso, about 120 kilometers (75 miles) northwest of the capital, Santiago, is home to Chile's national legislature.