The official death toll after police opened fire on protesting platinum miners in South Africa has risen to over 30.

The shooting, one of the worst in the area since the apartheid era, was sparked when police were confronted by thousands of angry workers at the Lonmin platinum mine, near Marikana, northwest of Johannesburg.

Officers attempted to turn away the crowds with water cannon and stun grenades before opening fire with automatic rifles, shotguns and pistols.

Zweli Mnisi, police spokesman, said that more than 30 people had been killed as workers fled from the barrage of gunfire.

He claimed officers had no choice as violent protests had already claimed nine lives, two of them police officers. He also said the protesters, many of whom were armed, fired shots.

He said: "We had a situation where people who were armed to the teeth, attack and kill others - even police officers.

"What should police do in such situations, when clearly what they are faced with are armed and hardcore criminals who murder police?"

President Jacob Zuma said he was "shocked and dismayed at this senseless violence".

The company had warned striking workers that they would lose their jobs on the day of the shooting.

The warning read: "The striking workers remain armed and away from work. This is illegal".

Investors have pulled away from Lonmin. Its stock dropped 6.91 percent, bringing its total losses since the start of the protest to 13 percent.

Click here to see more images of the shooting.

Protesters run as police open fire (Reuters)