A gunman killed six people in a hostage standoff in a Miami apartment building before being shot dead by police.

Television cameras showed elite police SWAT units storming the block at 6.30pm local time on Friday, after a standoff lasting eight hours.

"They made the decision to go in there and save and rescue the hostages," Sergeant Eddie Rodriguez told the AP.

In the footage, bright flashes can be seen through the window of the building and the crackle of gunfire heard as police exchaged shots with the gunman and killed him before rescuing two hostages the man was holding unharmed.

The violence started when two elderly building managers, Italo and Samira Pisciotti, who were 78 and 68, went to speak to a tenant who lived with his mother, reports the Miami Herald.

The man opened fire, shooting 15 to 20 rounds, and killing them both before going on to to shoot dead two more men and two women.

Five of the bodies were found inside the five-storey apartment building, in Hialeah, just north of Miami. One victim was found outside, with reports claiming he was targeted or hit by a stray bullet when entering a block opposite with his children.

"The end result; seven people have lost their lives in this incident - six innocent victims and the one shooter. Now starts the investigation - how and why this happened," said police spokesman Carl Zogby.

So far, the gunman's motives remain unknown.

"We think this may have been an angry man doing random shooting perhaps," Zogby said.