Military police say its members were shot at as they prepared to enter the Vila Cruzeiro slum to find and arrest leaders of criminal gangs.
One of those killed was a female resident who was accidentally killed by a bullet, the rest were criminals, according to police.
The raid is the deadliest in Rio de Janeiro so far this year.
Last year, 27 people and a policeman were killed in a raid in another favela, as slums are called in Brazil.
The police carry out recurring raids on the city's favelas to combat drug trafficking.