The detectives, who were in an unmarked car, were shot outside the Wilshire station about 4:30 a.m. as the driver used a card to open the gate to the parking area, the Los Angeles Times reported. Both suffered minor injuries.
Commander Andrew Smith said the shooter knew the officers, who were in plain clothes, were with the Police Department.
A 25-block area around the Wilshire station was closed to both foot and vehicle traffic while officers searched for the gunman. Security was tightened at stations around the city.
"While this seems like an isolated incident, out of an abundance of caution, all of our stations are on heightened alert," Smith said.
Three people had been detained, but Smith said none was believed to be the gunman.
Val Jones, 48, who lives near the Wilshire station, said she made a quick trip to an ATM at 6 a.m. to provide a friend with bus fare and was unable to return home.
"I'm tired, I'm ready to go home and I want some breakfast," Jones told the Times. "Other than that they have to do what they have to do. I'm fine. I'm glad I used the bathroom before I came out."