The shooting took place the between police and the male suspect on Wednesday evening when the officers were serving a drugs warrant at a house in Philadelphia's Nicetown-Tiago neighbourhood leading to the gunman to open fire, the BBC reported.
A seven-hour stand-off ensued as police urged the gunman to surrender.
A video on social media purportedly showed the suspect, named by US media as Maurice Hill, leaving the house with his hands in the air.
The suspect's lawyer Shaka Johnson told CBS3 that he helped police negotiate Hill's surrender.
A SWAT team rescued two officers and three others who were trapped inside the house with the gunman, the police said.
Police Commissioner Richard Ross said the SWAT team "were able to use stealth" to safely evacuate the officers from a "hostage situation".
Ross said the trapped officers were holding people they arrested during a raid "that went awry almost immediately".
According to local media reports, the shooter was said to be was livestreaming the incident on Facebook.
Meanwhile, the six officers who sustained non-life threatening injuries in the shooting have been released from hospital, the BBC reported.
Ross said "many of them had to escape through windows and doors" as the suspect fired.
"It's nothing short of a miracle that we don't have multiple officers killed today," the Commissioner added.
President Donald Trump was briefed on the shooting, deputy White House press secretary Hogan Gidley said.
The incident comes after two mass shootings - in El Paso, Texas and Dayton, Ohio - earlier this month that claimed the lives of 31 people within 24 hours.
( With inputs from IANS )