A man who shot at people in a car and standing nearby, killing a woman and wounding others early Saturday morning, died moments later as police fired at him, authorities said.

Two officers arrived just as 27-year-old Edwin Cordero Jr. was shooting into the vehicle, the Middlesex County prosecutor's office said.

Perth Amboy Officer Ganagioti Bouleris ordered Cordero to drop his gun, and when Cordero didn't comply, Bouleris fired five shots just as Cordero shot himself in the neck, the prosecutor's office said in a news release. Authorities didn't immediately disclose whether Bouleris' shots hit anyone.

The shooting took place shortly after 2 a.m. in a working-class neighborhood.

Fabia Aguilar, 26, of Plainfield, described by authorities as an acquaintance of Cordero's, was found dead with 12 wounds from his handgun.

Three other people, whose names were not immediately released, were taken to area hospitals. Two remained hospitalized following surgery, while a third with a gunshot wound to the leg was treated and released.

Of the three wounded, two were hit by rounds from Cordero's gun, according to the prosecutor's office. Police were investigating whose gunshots hit the third person.

Vincent Uveges, 46, said he and his family were woken up by shots and screams outside his house.

"I saw three guys on the ground. Two of them was wounded and one was obviously dead. It was a lot of shots going off very quickly. The guy who was lying dead on the sidewalk had a gun," Uveges said.

Laura Ruiz, 23, said her husband John Ruiz, 24, was the first person released from the hospital. She declined to discuss how the shooting happened.

"'Wrong place, wrong time,' is what he keeps telling me," she said.

The officers came across the shooting shortly after handling a disturbance at a nearby area bar, but the prosecutor's office said there was no indication the bar fight and the shooting were related.