A mid-afternoon blaze in the Libertad 2 section of Pavas destroyed four homes and heavily damaged two more.
Some 42 adults and three minors were left homeless or nearly so by the blaze in the cramped collection of low-income houses.
Some 27 fire fighters responded from San José, Pavas and even Heredia. One fire fighter suffered an electrical shock but was not injured seriously due to his protective gear, said the Cuerpo de Bomberos.
The fire department said that the blaze started in a rooming house that was used to provide living quarters for the homeless. Fire investigators are looking into four possible causes: candles, electrical problems, a wood stove and arson.