SAO PAULO -- A man broke into a house in southeastern Brazil where his ex-wife was ringing in the New Year and shot and killed her, their son and at least 10 other people before taking his own life, military police said Sunday.

The man was carrying "several firearms," when he attacked the family in Campinas, about 100 kilometres from Sao Paulo, according to Cpl. Marta Aurelia.

Thirteen people were killed, including the man's ex-wife, the couple's 8-year-old boy and other family members. Aurelia wasn't sure if that total included the gunman. Another three people were wounded.

At least one of those wounded escaped by running to a neighbour's house. Neighbor Christiano Machado said he heard the shots a little before midnight but assumed they were fireworks.

"When we opened the gate to go into the street to see the fireworks, the celebrations, a wounded person came into our yard. He entered, asking for help," he said in a video posted on the G1 news portal.

Violence against women is prevalent in Brazil, where disturbing cases are reported nearly every day. In May, images and video shared on social media brought to light the apparent gang rape of a 16-year-old girl in a case that rocked Brazil and drew promises from the government that more would be done to stem such violence. But shocking attacks have continued. In October, a 34-year-old woman alleged she was gang-raped in a bar on the outskirts of Rio de Janeiro and a man was caught on security video brutally beating up a woman, also in a bar.

The government has tried to address the problem. In 2015, it stiffened penalties for homicides of women and girls in which gender played a role. At the time, authorities said 15 women are killed daily in Brazil, often in situations of domestic violence.

The shooting capped off a year when violence in Brazil was in the spotlight as it hosted the Olympic Games in Rio de Janeiro. Much of the violence happens among drug-trafficking gangs or between those gangs and police in the sprawling slums of Brazil's major cities. Civilians and tourists have occasionally been caught up in that violence, often when they take a wrong turn and accidentally find themselves in a dangerous neighbourhood.

Last week also saw the killing of the Greek ambassador. Investigators believe that a policeman who was having an affair with the diplomat's wife carried assault after conspiring with her.