The students who died were boys mostly 15 and 16 years old.
Security cameras from homes near the school showed children climbing and jumping over a white wall that surrounds the Raul Brasil building, and sprinting down streets, screaming for help. Nine others were wounded in the school attack and hospitalized, he said.
The two assailants spent more than a year planning their attack, which they "hoped would draw more attention than the Columbine massacre", an investigator said on condition of anonymity.
"A monstrosity and cowardness without equal", Bolsonaro wrote in a tweet expressing his sympathies for the families of the victims of Wednesday's attacks. One teacher told police that the younger attacker had been bullied while he was a student there.
Latin America's largest nation has the largest number of annual homicides in the world, but school shootings are rare.
Police officers guard the entrance of the school
Four children were among the dead after two gunmen opened fire inside the school near Sao Paulo.
Gun laws have been extremely strict in Brazil since 2003 when former leftist President Luiz Inacio Lula de Silva signed measures that prevented ordinary citizens from carrying guns.
A soldier of the military police battalion and his dog take part in an instructional exercise with officers of an elite unit of the French police, who is responsible for anti-terrorist actions in France, at Terminal 1 of the Tom Jobim International Airport in Rio de Janeiro, Brazil, May 25, 2016. He grabbed one girl by the hair and punched her several times in the face.
After shooting at students in the yard, the killers "headed to the language center" where several pupils were hiding and "committed suicide in a corridor", added Sales. "I put my cell phone into his hand and he typed, with his dirty hands trembling, that he wanted me to call his mom", Gonçalves said.
The gunmen took their own lives, officials said. The motive for the shooting is not clear, police said. Local media reported that they turned their weapons on themselves after killing at least five students and an adult. Castro's body lay near Monteiro's, with the crossbow on the ground between the pair.