Police officials said the early morning explosion in the city of Surat, 250 kilometres from Gujarat's commercial capital Ahmedabad, was so powerful that two adjoining buildings also collapsed.
"Thirty-one people have died in the house collapse. Five of the 40 injured people have succumbed to their injuries," said Superintendent of Police at Surat, B.J. Patel
The blast is suspected to have been caused by a gas cylinder in a diamond processing factory that operated on the ground floor of the three-storey building.
Police said the toll shot up because more bodies were recovered from the blast site later in the evening while some of the victims succumbed to their injuries.
Several workers were feared trapped under the debris of the flattened buildings in Surat, which accounts for 90 percent of India's diamond exports worth $8 billion a year.
"We are investigating two possibilities: the cylinder could have leaked and a spark could have caused the explosion, or a furnace in the diamond cutting unit could have started a fire and triggered the blast," police commissioner, V.K.Gupta said.
He said the workers were asleep in the factory at the time of the blast.
"We believe there may be 10 or 15 more workers trapped inside, though we cannot be sure," he said.
Lonar Nath, a 14-year-old worker at the factory, said he was rescued by firefighters.
"I was sleeping. There was a huge explosion and I saw two pillars coming down on me. However, one was held by a wall and the other pillar fell on it, so I had a lucky escape."
The injured were admitted to three hospitals in the city and about 20 of them were in a serious condition, police said.