The gunman, 45-year-old Gary Martin, was killed while exchanging gunfire with law enforcement personnel, Aurora Police Chief Kristen Ziman said.
All five employees who died -- and all of the injured -- were men, police said.
Martin opened fire with a Smith & Wesson handgun at the Henry Pratt Co. in the Chicago suburb of the Aurora, shooting at terrified employees before engaging in the gunbattle with responding officers.
Martin was being let go Friday from his job at the company, police said. They did not give more details about why he was losing his job or whether he'd been notified before the shooting.
'He was just shooting everybody'
An employee who survived the shooting, told CNN affiliate WLS that the gunman was a coworker.
He was "running down the aisle" with a pistol that had a green laser sight on it, John Probst said.
"As soon as I saw the green thing and heard the shots, we left," said Probst, who's worked at the plant for 40 years. "He started opening up on the room, and he was just shooting everybody."
Probst said one of the victims who ran out with his arm bleeding told him the gunman "went ballistic."
90 minutes of terror
It took about 90 minutes after the shooting rampage started to control the situation, police said.
Calls about an active shooter started pouring in at 1:24 p.m., and police arrived at the scene four minutes later and surrounded the facility, Ziman said.
When officers stormed the 29,000-square-foot building to look for the gunman, he fired at them.
"Additional officers began to arrive and were also fired upon," Ziman said. Five officers were struck by gunfire and a sixth officer hurt his knee and needed to go to a hospital. All the shot officers were hit within the first five minutes of responding, Ziman said. Their injuries, and those of the injured worker, are not life-threatening, she said.
Henry Pratt Co. describes itself as one of the nation's largest manufacturers of industrial valves. Mueller Water Products, its parent company, said it's providing help to the affected families.
"Our hearts are with the victims and their loved ones, the first responders, the Aurora community and the entire Mueller family during this extremely difficult time," it said in a statement.
"Our entire focus is on the health and wellbeing of our colleagues, and we are committed to providing any and all support to them and their families."
A task force from the Kane County Sheriff's Office will investigate the gunman's death, Ziman said.
Police are working to identify the victims
Authorities have not publicly named the victims of the nation's latest mass shooting.
Illinois Gov. J.B. Pritzker, a Democrat who was sworn into office just more than a month ago, thanked law enforcement officials.
"There is no way to prepare. There are no words for the kind of evil that robs our neighbors of their hopes, their dreams and their futures," he said in a statement. "There are no words to express our gratitude to the families of the officers who were injured in the line of duty as they responded within moments to the gravest kind of danger that they can face."
Aurora Mayor Richard Irvin said mass shootings have become all too common in the nation.
"It's a shame that a cold and heartless offender would be so selfish as to think he has the right to take an innocent life. But we as a society cannot allow these horrific acts to become commonplace," he said.
Shocked neighbor speaks out
Martin's next-door neighbor, Mary McKnight, told CNN she wasn't close with him but the two would say hi in passing at their Aurora apartment complex.
"He seemed very friendly. He said hi to a lot of people who came and went. I'm kind of shocked, I guess," said McKnight, who said she moved into the complex over the summer. "I'm sad and shocked, and you kind of never know."
Aurora is the second-largest city in Illinois, with a population of about 200,000 people.