The incident occurred as more than a million Hindu devotees assembled for a religious bathing festival in the Godavari River outside the town of Nasik, about 110 miles northeast of Bombay.
Nasik Mayor Dashrath Patil said 39 people had been killed and at least 125 injured. Twenty-six of those killed were women, officials said, and two of the injured were police officers.
Ambulances rushed to the area as rescue workers urged the crowd to give way so the injured could be taken to hospitals. Cars and police vehicles were also used to bring in the dozens of injured people.
"There were some 50,000 people behind one barricade and they were pushing. The barricade suddenly broke and they just fell down," said Chhagan Bhujbal, deputy chief minister of Maharashtra state.
"People at the back just began walking on them and that's how the stampede happened," said Bhujbal. "It was a tragic accident."
Bamboo barricades are erected during the festival to try to funnel pilgrims safely to the water.
Survivors, many of them standing around in shock, said the collapse of the barricade set off a panic among falling, screaming pilgrims.
"Old women were crying, 'Take me out. Help me,"' said Lalji Mistry, a 35-year-old pilgrim who moved away from the crush in time.
Officials said the barricade, which was holding back a group of people waiting to get to the river, collapsed as they impatiently pushed against it.
"People, even women, were pushing forward. Due to the weight of the crowd, people started falling down," said Mistry, a marble craftsman from western Rajasthan state.
After the stampede, tens of thousands of pilgrims continued worshipping at the festival, which is spread across a 100 square kilometer (40 square mile) area in Panchwati, a northern Nashik suburb.
"Many don't know what's going on. They are still worshipping," said Mistry.
Hundreds of worried relatives gathered outside Nasik Civil Hospital seeking information about missing family members. Pawan Modi, 55, a businessman from eastern Bihar state, said authorities refused them entry because they were worried about controlling the large crowd.
"I have been searching for my sister for hours. I hope she is inside and is well," said Modi, whose sister was walking ahead of him when the stampede occurred.
"The crowd started pushing and I managed to move aside. I don't know if my sister escaped or if she was trapped inside," he said.
The Kumbh Mela festival is held every 12 years, timed in connection with alignments of the Sun and Jupiter. While the main festival is held near the city of Allahabad, the Nasik festival is one of the "mini-Kumbhs" that are held more often.
Stampedes are not uncommon at major Hindu religious festivals, which can attract millions of worshippers.
In 1999, 51 pilgrims died after a stampede caused a landslide at a Hindu shrine in southern India. The stampede began when a rope meant to channel the flow of people snapped.
In 1986, 50 people died in a stampede in the town of Haridwar, and in 1954 about 800 pilgrims died during the Kumbh Mela in Allahabad.
The Godavari is considered sacred by Hindus, who believe they can rid themselves of sin by bathing there during special days and festivals.
Some 60 million people are estimated to take part at various times during the festival, which started July 30 and ends Sept. 1.
Police in Nasik said 1.5 million to 1.6 million people were attending the festival Wednesday.
It has been a difficult week for the people of Maharashtra state. On Monday, a pair of car bombs exploded in Bombay, the state capital, killing 51 people. Authorities have blamed Muslim militants.