The mayor of Rio, Eduardo Paes, carried the torch on its first few laps through the city centre.
But there were chaotic scenes later in the north of the city when the torch relay was challenged by hundreds of demonstrators angry at the high cost of hosting the Games.
Riot police used tear gas and pepper spray to disperse the crowd.
Images shown on news websites showed at least one policeman appearing to fire a projectile directly at a protester.