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 So Paulo said the shooter, identified as 46-year-old Sidnei Ramis de Arajo, is believed to have been angry over a split with his wife, Isamara Filier, 41, and their son Joo Victor.
Three other people remain hospitalised, 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.
Arajo possibly sought to take advantage of the commotion of New Year's Eve to disguise the shooting, police said.
One neighbour 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 Arajo, 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 analysing the explosives in addition to a cell phone and audio recorder found in a car he parked outside the home to determine whether Arajo left any sort of message about his attack.
Police said they did not yet know if Arajo 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 kilometres (60 miles) northwest of the city of So Paulo, Brazil's biggest metropolis. -Reuters