Government Spokesman Isaac Mwaura said the fire, which started at around 11:30 p.m. Thursday local time (2030 GMT), was caused by a truck loaded with gas cylinders that exploded, igniting a huge fireball that spread to a warehouse and a neighborhood nearby.
A flying gas cylinder hit a garments and textiles warehouse, burning it down, Mwaura said in a statement.
He said the fire also damaged several vehicles and commercial properties, including many small and medium-sized businesses, in the Embakasi neighborhood.
"Sadly, residential houses in the neighborhood also caught fire, with a good number of residents still inside as it was late at night," Mwaura added.
Embakasi police commander Wesley Kimeto confirmed the death toll, saying one adult and a minor had died in the hospital, and that the number of casualties may increase later.
A video posted on social media showed a huge fire raging close to blocks of flats.
The Kenya Red Cross Society said a total of 271 individuals have been successfully evacuated to several health facilities in Nairobi.
The latest incident came after a fire broke out on Tuesday night near a local stadium in downtown Nairobi, injuring four people.