Police in the state of São Paulo said the shooter is believed to have been angry over a separation from his former wife, who was among those killed.
Local media reports said the couple’s 8-year-old son also died.
A police spokesman could not confirm the identity or age of those killed or whether a child of the shooter, who also remained unidentified, was among the victims.
Local media reported that a total of 15 people had been shot and several in critical condition.
A neighbour interviewed by the Globo television network said that he and his family members heard blasts about a quarter to midnight but did not immediately recognize if
it was gunfire or fireworks.
The neighbour said it was only when one of those shot ran into their property bleeding and asking for help that they realised that someone had been shooting and the
state police were called to the scene at 12.40 a.m. local time.
Although Brazil struggles with high rates of crime and violence, mass shootings are uncommon.
Gun deaths are frequent in heists, holdups and in confrontations among police, drug gangs and other criminals, but shooting sprees like those often seen in the United States are not prevalent.