Dozens of shoppers fled; many are still feared trapped inside.
A senior police officer originally said it was an attempted robbery but later called it a possible terrorist attack.
The Somali militant group al-Shabab had threatened to strike the centre.
It is opposed to Kenya sending troops to fight in Somalia. No group has said it carried out Saturday’s attack.
Officers have now surrounded the building in an attempt to evacuate remaining shoppers. A military helicopter has landed nearby.
Police told AFP news agency that gunmen had taken at least seven people hostage. Eyewitnesses have also said there are hostages, but there is no official confirmation.
Dozens of people are reported to have been injured.
Eyewitnesses say masked attackers threw grenades into the building at about midday local time.
Nairobi police chief Benson Kibue initially said the gunmen had been trying to rob a shop, but later called it “a terrorist attack”.
At about 18:30, more than six hours after the attack began, the Kenyan Secretary for the Interior Joseph ole Lenku said the security situation was “under control”.
He urged the public “not to speculate” about the nature of the attack, and said most people had been evacuated.
There are reports one of the gunmen has been shot dead.
Some of the attackers were reportedly dressed in hijabs, and it is unclear whether they were men or women, our correspondent says.
One man who escaped had been hiding in a supermarket but told our correspondent his friends were still trapped inside the building.
Witnesses told news agencies the gunmen ordered Muslims to leave and that non-Muslims would be targeted.
The Kenyan authorities have asked media outlets to stop broadcasting from the scene, as the information may be aiding the attackers.
Security guards used shopping trolleys to wheel out several wounded children and at least one man, AP reports.
“The gunmen tried to fire at my head but missed. There are definitely many casualties,” Sudjar Singh, who works at the shopping centre, told AFP.
“I saw three of the attackers dressed in black and with covered faces and they were carrying heavy rifles,” said another witness.
AFP quoted witnesses as saying the gunmen were speaking Arabic or Somali and executed shoppers.
Armed police took cover behind vehicles outside.
“We have officers at the scene trying to get out the group shooting inside,” a police official told AFP news agency.
“Officers are approaching the situation with caution because there are innocent civilians inside,” he said.
The Westgate centre is often frequented by wealthy Kenyans and expatriates.
Police have urged residents to stay away from the area and told media outlets to stop live transmissions from the scene.
YAo3rqPwXLsThe US House Ethics Committee has voted to release its report on former Republican Representative…
ABC News has agreed to pay $15 million to President-elect Donald Trump to settle a…
South Korea’s parliament has voted to impeach President Yoon Suk Yeol over his failed attempt…
Israeli war planes have carried out more than 100 air strikes in Syria on December…
President-elect Donald Trump has threatened to impose 100% tariffs on the BRICS countries if they…
Syrian troops have withdrawn from the city of Aleppo following an offensive by rebels opposed…