president has defended freeing drug kingpin Joaquín "El Chapo"
Guzmán's son soon after his arrest.
When Ovidio Guzmán López was seized at a house on a judge's warrant in the city of Culiacán, cartel gunmen fought street battles with security forces.
At least eight people were reportedly killed and 21 wounded, with vehicles left burning in the streets.
President Andres Manuel Lopez Obrador said the decision to cancel the arrest had saved lives.
Senior security officials had decided on his release, the president said at a news conference.
"The officials who took this decision did well," he said.
As the gun battles raged, a lawyer for the Guzmán family told the Associated Press, "Ovidio is alive and free."
Mr López Obrador was elected on a platform of cracking down on Mexico's drug cartels, and has tasked the National Guard, a new security force, with fighting the dealers.
Under El Chapo's leadership, the Sinaloa cartel was the biggest supplier of drugs to the US, officials say.
The kingpin was jailed earlier this year, and Ovidio Guzmán Lopez is one of several brothers with a hand in running the cartel.
Thought to be in his twenties, he is accused of drug trafficking in the US.
What happened in Culiacán?
A patrol of National Guard militarised police came under intense fire from a house, Security Minister Alfonso Durazo said.
The security forces fought back and found Mr Guzmán, but were then surrounded by gunmen and forced to retreat.
Fighters also attacked security forces in other parts of Culiacán and bodies were seen on the streets.
Witnesses described scenes of panic in the city, a stronghold of the Sinaloa cartel, as families with small children fled from gunfire.
Footage on social media showed a pick-up truck with a machine gun mounted on the back, in scenes reminiscent of a war zone.
Other footage showed families scrambling to take cover under cars and in shops as bullets flew. In one video, a girl asked her father: "Why are they shooting bullets?"
A purported mugshot taken of Mr Guzmán while he was detained by police was shared widely on social media.