Nearby police officers engaged Connor Betts, 24, shortly after hearing gunfire, as he tried to make his way into a crowded bar.
Dayton police chief Richard Biehl said that had he made it through the door, the loss of life would have been "catastrophic".
The gunman's motives are unclear.
At least 27 people were injured in the shooting, the second such attack in the US within 24 hours.
Betts fired his first shot at 01:05 local time (05:05 GMT) in the Oregon district of the city centre, Mr Biehl said. Dozens more rounds followed.
Security camera footage shows dozens of people racing through the doorway of the local Ned Peppers nightclub.
Seconds later, Betts is seen running towards the venue and being hit by police gunfire as he reaches the door.
Betts wore body armour and came carrying extra ammunition for his .223-calibre assault rifle with high-capacity magazines.
"Had this individual made it through the doorway of Ned Peppers with that level of weaponry, there would have been catastrophic injury and loss of life," Mr Biehl said.
The rifle was ordered online from Texas, police said, and there was nothing in his history that would have stopped him from buying the gun legally.
The gunman's sister, Megan Betts, aged 22, was among the dead.
"She was not the first victim, but she was one of the initial victims," Mr Biehl said.
Officials said it was too early to speculate about motives.
But responding to questions about a possible racial element to the killings, Mr Biehl said there was nothing to suggest a "bias motive".
Nearby hospitals had received 27 people for treatment, and discharged 15 of them, by 10:00 local time.
The Gun Violence Archive, which categorises mass shootings in the US as four or more people shot or killed, says there have been 251 so far this year.