Witnesses described a chaotic scene that started when the man showed up uninvited at the party and told about a dozen people there that he blamed them for his wife leaving him, said homicide detective Ervens Ford.
Then he opened fire. Some took cover while others, including a pregnant woman, ran into the street.
"It was chaotic," Ford said. "I can't imagine what it was like in there."
The man also killed his 51-year-old wife's mother and daughter, along with her daughter's boyfriend, whose birthday they were celebrating, Ford said.
Police did not release the victims' names because other family members had not been notified. They said the man and his wife were married about four years and they weren't sure when she left him.
Officers got a call shortly after midnight that numerous shots had been fired and a red pickup truck had been spotted leaving the scene.
Juan Sosa, who lives a block away, was out walking his dog early Sunday when he heard two shots and saw people running toward him, screaming. Then he heard as many as two dozen more shots and ducked behind a large tree to call police.
"I didn't want to get hit," he said.
The pregnant woman who fled was taken to the hospital as a precaution, but she was not hurt.
Soon after, someone called 911 to say a building about three miles away was on fire and more shots had been fired. That's where officials found the alleged gunman dead. Ford said he set fire to both his truck and the building he lived in before shooting himself.
Janseen Almodovar, who lives across the street, rushed outside when he heard people screaming and honking. He said the entire building and a truck out front were in flames.
"We thought the truck was going to blow up," Almodovar said.
Panicked neighbors weren't sure if anyone was inside the one-story ivory stucco building, but they couldn't knock because the fire was so intense.
Landlord Abel Loredo, who owns the building where the alleged gunman shot himself, said the man had lived there for five years and had always been on time with the rent for his one-bedroom, one-bathroom apartment.
Loredo declined to identify the man but said he had moved from Cuba about a decade ago and seemed very nice. The man was a cook at a restaurant in nearby Little Havana for a time before becoming an electrician a few years ago.
Neighbors of the alleged gunman say the couple never had any problems with the police and liked to barbeque in their yard, reports CBS Station WFOR in Miami. The man's wife and her son had lived with him at some point, according to Loredo but it was unclear if they were still living there.
Sosa said he had seen the truck driving around the neighborhood earlier and that his father remembered seeing it several times in the last few weeks.
He did not know the people who were killed but said he felt badly for them.
"I feel sorry for the family," he said. "There's no excuse for that."