The US Embassy in Manila also said that the US special operation forces were assisting the Filipino troops in battling the Maute and Abu Sayyaf militants in the besieged city.
Herrera said security forces were struggling to contain the fighters without causing civilian casualties.
Their involvement comes after months of strain between the two allies stoked by Philippines President Rodrigo Duterte's hostility towards Washington and his pledges to evict U.S. troops, who have long provided training and assistance.
The Agence France-Presse news agency reported the military as saying that the militants occupied about 10 percent of the city and were using bomb-proof tunnels and anti-tank weapons.
About 40 foreigners have fought alongside the Philippine militants in Marawi City, a lot of them from Indonesia and Malaysia, though some came from the Middle East.
It is the biggest loss for government forces in a single day, the military said.
The marines were on an operation to rescue about 100 hostages held by the militants, who set off improvised explosive devices and fired rocket-propelled grenades at the advancing troops, Herrera said.
Schapelle Corby back home but not seen
Corby has been spending her final days effectively in hiding in her home in Kuta . "She is fine. healthy. she is well", he said. Dr Agung Hartawan from Kerobokan jail visits Schapelle Corby's house in Kuta lane with a parole officer to check her health.
The little-known Maute group has been a fierce enemy of a military with superior firepower and greater troop strength.
At least 200 militants are holed up in a corner of the town.
The presence of the United States, he said, provides only intelligence exchanges, training and technical support.
Philippine military leaders have said their troops unexpectedly interrupted plans by the fighters to take over Marawi in a spectacular event to show that IS had arrived in the Philippines and was intent on carving out territory.
Philippine Army 1st Infantry Division spokesperson Lt. Col. Jo-Ar Herrera was quoted by ABS-CBN News as saying that the fatalities were marines who were rescuing trapped civilians in the conflict-torn city.
Col Herrera confirmed for the first time that U.S. special forces were helping the army.
The BBC's Jonathan Head says there are several reports that the Maute brothers, who lead the Maute group, are among the dead, with intercepted communications from jihadist groups suggesting this.