Residents try to make their way to safety after the Jamapa River overflowed in the town of Jamapa, Mexico (AP)

Tropical Storm Ernesto has weakened to a tropical depression as it moves inland over Mexico, killing seven people and dumping rains in the mountains of Mexico's flood-prone southern Gulf region.

Five people were killed in Veracruz state, including a teenage girl who was inside a car dragged by a river current, and a 62-year-old man who was struck by lightning, the state's civil protection department said.

The statement said three members of a family - a 38-year-old man, his wife and their eight-year-old boy -also died when strong winds knocked down a tree that fell on their car.

In neighbouring Tabasco state, two fishermen drowned when the stormed passed through the area, Governor Andres Granier said.

He said strong winds ripped rooftops from several homes but residents refused to evacuate, fearing their possessions might be stolen. "People have chosen to stay in their homes and we are helping them," he said.

Ernesto came ashore on Thursday near the waters dotted with oil rigs operated by the state oil company in the far southern Gulf of Mexico. The government closed its largest Gulf coast port, Veracruz, and the smaller ports of Alvarado and Coatzacoalcos.

Coatzacoalcos, a major oil port, got seven inches of rain in the 24 hours before Ernesto's centre passed just a few miles away, according to Mexico's weather service. San Pedro in the neighbouring state of Tabasco had seen more than 10 inches.

The US National Hurricane Centre said Ernesto's sustained winds had decreased to 35mph by early Friday. It said the storm would continue weakening and should dissipate, although it warned that heavy rains could continue.

Ernesto was a weak hurricane when it made its first landfall late on Tuesday near the cruise ship port of Mahahual in Yucatan, but it weakened as it crossed the peninsula and then spun into the Gulf of Mexico on Wednesday night. Early on Friday, the storm was centred about 100 miles north west of Oaxaca and moving west at nearly 13mph.

The US hurricane centre said Ernesto still had the potential to cause flooding and could produce rainfall of up to 15 inches in some parts of the mountainous areas of Veracruz, Tabasco, Puebla and Oaxaca states before dissipating. There were no reports of major flooding in Veracruz state and there have been only minor landslides on some roads, said Raul Zarrabal, the state's communications secretary.

PA