The officers were fired upon near 65th Street and Broadway in the Florence neighborhood just before 5:45 p.m., Det. Meghan Aguilar said. The officers then returned fire.
Aguilar said the officers, assigned to the 77th Street Division narcotics section, were driving in an unmarked police car. She said there was no indication they were caught in crossfire between rival groups but rather believed the shots were meant for them.
"Of course, because it's an active scene, that's our preliminary investigation," she said. "There's going to be several thorough interviews of the officers. But right now they believe they were the target."
Both officers sustained minor injuries and were treated at the scene.
Police apprehended several people at the scene, and the search continues for two others in the neighborhood, she said. The LAPD's SWAT unit was on scene along with dozens of officers.
A large section of the neighborhood was cordoned off as police conducted a block-to-block search assisted by a K-9 unit.
"We are asking the public to shelter in place and notify police if they see any unusual activity in their houses or yards," Aguilar said.
Junior Moore, 54, said he was eating at Hercules Burgers at Broadway and Gage Avenue when the gunfire erupted.
"I heard like 20 shots, and then a bunch of police sirens," Moore said.
Priscilla Gutierrez, 17, lives two blocks from where the shooting occurred.
She was on her way home from dinner with her mother and sister when they saw police tape blocking off their street.
Police told them it could take up to eight hours before they'd be allowed to return home.
The family was among about 50 residents clustered behind police tape at Gage and Broadway.
Neighbors snapped photos as dozens of police cars arrived on scene and officers brought out SWAT gear, including long black rifles.
They watched as three large armored SWAT vehicles entered the crime scene.
Gutierrez, who moved to the neighborhood two weeks ago, said she has heard gunfire erupt in the blocks near her house multiple times since Friday.
"We've been hearing gunshots," she said. "We don't go outside."
This story will be updated as more information becomes available.
For breaking news in California, follow @MattHjourno.