Television stations showed images of rescue workers sifting through metal sheeting and slabs of concrete at the Precious Talent School, and carrying white body bags to an ambulance.
“We have regrettably lost seven lives to this morning’s incident that occurred around 8 a.m., As the learners of Class Five to Eight were starting their morning lessons,” Education Cabinet Secretary George Magoha said at the scene of the accident, Reuters reported.
In Kenya’s school system, classes five to eight usually covers children aged from 10 to 14 years.
He added that 64 children had been taken to hospital for treatment, with two of them having serious injuries.
The first floor of the building collapsed, trapping the children below, local lawmaker John Kiarie told NTV Kenya earlier.
Magoha said more than 600 children from the school underwent check-ups at a nearby health centre, and also ordered the school closed for four days for safety checks.
The cause was not immediately known, but authorities have previously warned 30,000 to 40,000 buildings erected without approval in Nairobi are at risk of collapse.
Three years, ago a six-storey residential block collapsed in Nairobi, killing 51 people following heavy rain.