The officer has been identified as 22-year-old Jason Rivera.
A second officer, 27-year-old Wilbert Mora, was also shot and is fighting for his life.
Police say Rivera, Mora and a third officer were sent to an apartment at 119 W. 135th St. around 6:15 p.m. in response to a 911 call from a woman who said she was in a dispute with her son. The caller did not mention any injuries or any weapons, Chief of Detectives James Essig said.
When the officers entered the apartment, they encountered the woman and another son. The woman said the son she had been arguing with, who has been identified as 47-year-old Lashawn McNeil, was in the back bedroom.
One officer remained with the woman and son while Rivera and Mora went down a long, narrow hallway to the back bedroom.
Police say the door to the bedroom then swung open and numerous shots were fired, striking Rivera and Mora.
McNeil then tried to leave the apartment, coming down the same hallway where the two officers were shot. He encountered the third officer, who fired two shots, striking McNeil in the right arm and the head.
WATCH: Mayor Adams, Police Officials Give Update --
A neighbor told CBS2's Ali Bauman he heard the shots.
"Around 10 or 15 shots came from behind my building, which is, I'm not going to say not normal, but it's the occurrence here in Harlem. It's been getting bad over the last year or so," he said. "I thought they were fireworks."
"Around 10 to 15 shots, like rapid fire. I thought they were fireworks, then I'm like, nobody does fireworks in January," Harlem resident Jordan Sartor said.
"You hear all the sirens. You see all the cars. It's sad. It's sad. It's just sad. We got enough problems in this world, we don't... This is not it," one person told CBS2's Dick Brennan.
The injured officers and McNeil were taken to Harlem Hospital, where Rivera later died.
McNeil underwent surgery at the hospital. His current condition is unknown.
Initial reports suggested the third officer who fired at McNeil also sustained some injuries in the incident.
Watch Ali Bauman's report --
A woman who works at Harlem Hospital told CBS2's Cory James she saw the chaos as she was leaving.
"Two of the nurses were running by, saying, 'Move out of the way, move out of the way, emergency, emergency,'" she said.
Dozens and dozens of NYPD officers filled the halls of Harlem Hospital for hours, standing in support of a fallen brother and one fighting for his life.
Mayor Eric Adams said even though only top police officials are usually present at press conferences, he specifically wanted everyone to be in the same room Friday night.
Both the mayor and police commissioner were praying with the officers' families and are asking New York to pray for them.
"They came to answer a call for service. What countless officers do every single day," NYPD Commissioner Keechant Sewell said.
Watch Chopper 2 over Harlem Hospital --
"It is our city against the killers. It is our city against the killers. This was just not an attack on three brave officers. This was an attack on the city of New York. It is an attack on the children and families of this city. And we are not going to win this battle by dividing lines between us. We must save this city together. That is what we must do," Adams said.
He called on Washington to help stop the flow of guns into the city.
"We are going to find these guns and we are going to find those who carry them and use them. We are committed to ending this violence. My heart goes out to these families who are experiencing such a traumatic experience," Adams said.
"Our department is hurting. Our city is hurting. It is beyond comprehension," Sewell said.
Meanwhile, police say they recovered a gun from the scene that had been stolen from Baltimore in 2017. It was a .45 caliber pistol with a high-capacity magazine.
McNeil had one prior arrest in New York City for a felony conviction of narcotics in 2003. He was on probation.
He also had four prior arrests outside of New York City for various charges including assault on a police officer and weapons possession.
Manhattan District Attorney Alvin Bragg responded to the incident on Twitter, saying, "This is a horrible tragedy and our thoughts and prayers go out to the officers, their families and the entire NYPD. The officers who serve and protect us risk their lives every day. Violence against police cannot be tolerated."
New York Attorney General Letitia James released a statement, saying, "All of New York state is in mourning tonight. As we await the facts, my office may assert jurisdiction in this matter. We pray for the safety of our police and our communities."
Gov. Kathy Hochul released the following statement:
"I am horrified by tonight's tragedy in Harlem. My thoughts are with the family who answered the phone to receive the news they've always dreaded: that their loved one, who had sworn to protect and serve New Yorkers by joining the NYPD, will not be coming home. I am praying for the recovery of his partner, the officer who is fighting for his life, and for his family. I know that all of New York is standing with these officers and their families.
"We must urgently confront the plague of gun violence in our state. Too many lives are being lost, and too many New Yorkers are living in fear. This is a crisis. That's why earlier today, I extended an Executive Order declaring a gun violence State of Emergency. In the Executive Budget I released earlier this week, I put forward a plan to triple resources for our gun interdiction efforts, so that we stop the flow of illegal guns into our state, and also triple resources for violence interrupter programs to address the root causes of violence.
"I refuse to allow our cities to be gripped with fear. New Yorkers deserve action from their elected officials — and they will get it. I've pledged my full support to Mayor Eric Adams and look forward to working with him and other leaders to continue to take meaningful actions to make New Yorkers safer."
Harlem residents spoke to CBS2 about the gun violence in the city.
"They're starting to get out of hand. I think the approach needs to be different. I think they need to be more aggressive," one person said.
"We're about to have a baby, too, so that kind of makes it worse. You want to be able to walk your child in a stroller and feel safe at night. I do my laundry right where the shooting happened. Just a sad night," another person said.
"I'm sad. I'm a big fan of the NYPD. I know what a crazy year we've had. Black Lives Matter and everyone, you know, talks down on the cops, but as a Black man, a military veteran, I love these guys and women and what they do. I always see them out and I always say thank you, so it's just sad," Sartor said.
Including Friday night's incident, four officers have been shot this week, and a total of five police officers have been shot this month.
On New Year's Day, an NYPD officer was shot while resting in his car between shifts in East Harlem. Officials believe he was hit in the head by a stray bullet. That officer was treated and released from the hospital.
CBS2's Dick Brennan, Ali Bauman and Cory James contributed to this report.
for more features.