Wellington Oliveira
He took his own life after police intervened. Officials said 11 people were wounded - many in the head - in the attack.
Earlier, it was reported that De Oliveira shot dead 10 children, but the toll was later clarified as 11 dead, before the death of a 13-year-old boy in hospital raised the toll to 12.
Employees of the school told officers the young man arrived well-dressed and carrying a backpack, and said he told them he had been invited to speak with students in a school conference," Colonel Bezerra said.
"That's how he gained access to the third floor", where he launched his attack on at least one classroom, sending terrified students running down the stairs and out the building.
Military police colonel Djalma Beltrame said police stormed the school and wounded the attacker, "but the man killed himself with a gunshot to the head".