The shooting occurred on the 19100 block of Elberland Street at about 5 p.m. No sheriff's deputies were injured.
Deputies were searching for a suspect in a residential backyard following a pursuit of robbery suspects, according to the L.A. County Sheriff's Department.
"Walnut sheriff's station received a 911 call from a man who said that there was a man inside his home. He was armed with a gun. He was demanding money from his mother," said Lt. Steve Jauch with the sheriff's department.
Deputies responded to the residential neighborhood and saw the suspect's vehicle speeding away. That's when the pursuit started.
Investigators say the chase ended at the Bestway supermarket and the male suspect got out. He ran through the market and then into a resident's backyard, where he was fatally shot by deputies.
A woman and a 5-year-old child were in the suspect's car. The woman was detained at the store, and the child was taken into protective custody.
The incident was under investigation.