They were not members of so-called Islamic State but had tried to make contact with the group, officials said.
The justice minister said the group was in the planning stage of an attack and police acted as a preventative measure.
Alexandre Moraes described the cell as “absolute amateurs” and “ill-prepared” to launch an attack.
All those arrested were Brazilian and two more suspects were being sought, he said.
They were detained across 10 different states, and had been in contact via messaging services such as Whatsapp.
Group members had attempted to contact a weapons supplier in neighbouring Paraguay to get AK 47 assault rifles, but there was no evidence of any being bought.
An emergency meeting of the Brazilian cabinet has been called.
More than 80,000 police and soldiers will patrol Rio streets for the games which end on 21 August.
The federal government said last week that it was releasing an extra $24m (£18m) to beef up security ahead of the Olympics.
The International Olympic Committee recently concluded that Rio de Janeiro had overcome setbacks and was “ready to welcome the world” to the 2016 Olympics.
There have been fears over Rio’s readiness because of building delays, the Zika virus and political crises.
Mr Moraes told a news conference there was a “minimal probability of a terrorist act during the Rio Olympics.”