A gunman stormed a house party and killed 11 people, including his former wife and 8-year-old son, before shooting himself in the head during a New Year's party in the southeastern Brazilian city of Campinas late on Saturday.
Police in the state of São Paulo said the shooter, identified as 46-year-old Sidnei Ramis de Araújo, is believed to have been angry over a split with his wife, Isamara Filier, 41, and their son João Victor.
Three other people remain hospitalized, police said, while four people survived the attack unharmed, including one party attendee who managed to flee to a bathroom and phone the police when the shooting began.
Survivors, according to a police spokesman, said that just before midnight, the shooter jumped over a fence surrounding the house, burst through a door and began firing even as he berated Filier for taking their son.
Araújo possibly sought to take advantage of the commotion of New Year's Eve to disguise the shooting, police said
One neighbor told local television that he and his family heard shots, but had thought they might be fireworks until one of the wounded ran to their property, bleeding and pleading for help.
Despite high rates of crime and violence in Brazil, including significant problems with assaults against women, the attack alarmed Latin America's biggest country on a holiday associated with family gatherings.
Gun deaths are common in heists, holdups and in confrontations among police, drug gangs and other criminals in Brazil, but targeted mass shootings are rare.
Police said Araújo, reported by local media to be a laboratory technician, used a 9 mm pistol and carried two additional clips, extra ammunition, a knife and unspecified but unused explosives.
Investigators are analyzing the explosives in addition to a cell phone and audio recorder found in a car he parked outside the home to determine whether Araújo left any sort of message about his attack.
Police said they did not yet know if Araújo had a history of violence, or whether he had been known to physically harm or threaten his former wife before the attack.
Campinas, an industrial and university city of over 1 million residents, is located about 100 kilometers (60 miles) northwest of the city of São Paulo, Brazil's biggest metropolis.