Iran's President Hassan Rouhani faced furious protests from coal miners and their families on Sunday when he visited the site of an accident that claimed dozens of lives, two weeks ahead of an election.

Local news agencies showed people surrounding Rouhani's car and beating on the windows in northern Golestan province as it tried to make its way through an angry crowd at the mine site, where at least 26 people were killed by an explosion on Wednesday.

At least nine more miners were trapped inside, but officials say there is little chance they survived.

The accident is thought to have been caused by concentrated methane gas that was ignited when workers tried to jumpstart an engine.

"The entire Iranian nation shares the sorrow of families of those killed in the Zemestanyurt mine accident. We are all responsible for this incident," said Rouhani, calling for tighter regulations in the mining sector.

The miners were angry over poor safety conditions and delayed wages, as thousands of factories and industrial sites across the country have struggled to keep up with payments in recent years because of the stagnant economy.

"Why is there no safety at the mine? Why does no one care?" the spokesman for the miners can be seen shouting at the scene in a video shared on social media.

"Last year, we gathered in front of the governor's office together with our wives because we were unpaid for 14 months. And you, the president, didn't even notice."

Conservative presidential candidates trying to unseat Rouhani have focused on the poor, saying government policies have only benefited the wealthy.

The miners' spokesman said workers earn 10 million rials ($265) a month. "Can you live with that?" he asked the president in the video.

"Look at the mother with seven children. We have nothing to eat."

Labour Minister Ali Rabii travelled 1,400 metres into the mine, where rescue teams have been trying to unblock a collapsed tunnel as the search for survivors continues.

Rouhani has ordered a task force to investigate the causes of the explosion and handle compensation for victims and their families.