Gunmen stormed an informal settlement in Johannesburg and shot 12 people dead overnight, South African police said on Wednesday, in the latest mass shooting in the country.

The shootings happened before midnight on Tuesday in an impoverished shantytown of metal and wooden shacks near where illegal miners were living and working, police said.

Around 10 attackers were driven to the Jumpers settlement and dropped off before storming the area, a police spokesperson 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," the spokesperson said.

"Preliminary investigations reveal that 12 people died as a result of the attack," Colonel Dimakatso Nevhuhulwi said.