Black-clad officers from elite police units seized the Alemao slum complex amid heavy fire, with police and army helicopters flying low to support the men on the ground. But they encountered less resistance than expected, even if many gang members still remained inside.
"We won," said Mario Sergio Duarte, head of Rio de Janeiro's state military police. "We brought freedom to the residents of Alemao."
The operation was crucial to the city's campaign to push criminals out of slums where they have ruled with impunity, and secure Rio before it hosts the Olympics.
The operation came after gangs unleashed a week of violence, with more than 100 cars and buses set on fire and at least 35 deaths, mostly of suspected traffickers.
There were no reports of injuries in yesterday's operation, which began just after sunrise. Police said they captured large amounts of weapons, ammunition and drugs in the complex, which includes a dozen slums that are home to at least 85,000 people.
"It's all calm," police inspector Rodrigo Oliveira said. "There is no doubt that Rio residents have reason to celebrate today. The complex was seen as a fortress for drug traffickers and in less than two hours we took control."
Some gunmen began to surrender and some were arrested, but police were still searching the shacks on the hills of the shanty town to try to find those trying to flee.
"We have to be careful because they may be trying to set up traps for our men," Mr Duarte said. But he promised that "we won't leave a place unchecked".
Police and troops moved into the slum inside armoured vehicles as residents watched from their windows.
Vehicles from the forestry service carried troops to the jungle areas inside the complex to cut back trees and eliminate possible escape routes.
Many residents were thrilled with the police operation. "Fantastic, this is exactly the thing we needed," said Ana Costa, 48.
"This community has been so violent for so long that I never thought that I would see this day. I'm praying that peace has finally come here."
Hundreds of soldiers in camouflage and elite and regular police had been surrounding the Alemao since Saturday night, sheltering behind the armoured vehicles. They had exchanged intermittent, heavy gunfire with gang members at many of the 44 entrances to the slum where about 600 armed gang members were believed to be trapped.