The incident occurred about 3:47 a.m. in the 38500 block of 10th Street East, the Los Angeles County Sheriff's Department said in a statement.
Deputies at the scene said they initially responded to a report of loud music at a party. As they were conducting an investigation, one of the deputies was allegedly bitten by a pit bull. The deputy was not seriously injured.
The dog was restrained by a person at the scene, but as the investigation continued the animal got loose again and charged at the deputies, authorities said. The deputies then opened fire on the pit bull.
Amid the shooting, a friend of the dog's owner allegedly raced around a corner in an effort to apprehend the animal. Caught in the line of fire, the teen was struck at least once in the upper torso, sheriff's deputies said.
The 17-year-old was transported to a hospital where he was pronounced dead. His aunt identified him as Armando Garcia.
"He was trying to stop the dog from attacking the cops, and they shot both of them, I guess," said Nick Perez, a friend of Garcia.
Sheriff's officials gave additional details about the incident at news conference.
"We believe that when the individual came out from behind the building, which was approximately 40 feet away from where the shooting occurred, he may have been struck by one of the skip rounds," sheriff's Capt. Christopher Bergner said. "It is what we're calling an extremely, extremely unfortunate incident at this time."
A deputy was also struck by a "skip" round, sheriff's officials said. He was treated at a medical center and released.
Homicide Bureau detectives responded to the scene, where a section of 10th Street was closed.
Local residents said pit bulls are frequently seen running loose in the neighborhood.
"Every house on this left-hand side has pit bulls," neighbor Michelle Robinson said as she pointed toward some nearby homes. "Sometimes I'll stop and wait until the owner comes and gets it away from me."
Anyone with information about the incident is asked to call the sheriff's department at (323) 890-5500.