The incident happened at 11:30 p.m. Monday inside a home on the 6100 block of Reach Street.
A 35-year-old man, masked and armed, barged into the house and announced a robbery to the five people inside.
"The 35-year-old entered the property through the front door, gun in hand, and announced the robbery," said Philadelphia Police Chief Inspector Scott Small.
Investigators say the 27-year-old homeowner took out his gun and fired at least four shots.
The intruder was hit twice and collapsed, dropping his handgun by his feet.
Meanwhile two women who live in the home had gone to get their own semiautomatic weapons.
"However, we don't believe those females fired any shots," Small said.
When police arrived, they found the 35-year-old on the dining room floor.
He had been shot in the neck and chest, and first responders were unable to revive him.
Investigators soon discovered nearby what appeared to be a half pound of marijuana, packaging materials and several hundred dollars.
"There's a very good possibility in this home invasion-robbery that the motive was to steal this narcotics-related money," said Small.
The five people in the home were taken to Philadelphia Police Homicide Division headquarters for questioning.