
The attack occurred shortly after 11:00 p.m. on Tuesday in Cleveland, an area about six kilometres east of Johannesburg's city centre.
More than 10 armed suspects arrived in a vehicle and entered the settlement through multiple access points before opening fire on residents at several locations, police spokeswoman Colonel Dimakatso Nevhuhulwi said.
"The suspects allegedly entered the informal settlement through both entrances and moved through the area, opening fire on residents and community members at multiple locations before fleeing the scene in the same vehicle," she said.
Preliminary investigations found that 12 people were killed in the attack. Eleven victims — eight men and three women — were declared dead at the scene, while another person later died in hospital.
Police said the motive remains unknown and no arrests have been made.
The shooting is the latest episode of mass violence in South Africa, where crime rates remain among the highest in the world. More than 60 homicides are recorded on average each day.
The country is awash with both legal and illegal firearms, and deadly shootings are common, often linked to gang rivalries, organised crime and disputes involving informal businesses.