The shooting happened at about 11 p.m. near Anaheim Street and Gundry Avenue near MacArthur Park.
Investigators said the anti-gang detective was driving in an unmarked car with another officer when they noticed gang activity at the park.
Authorities said a vehicle suddenly pulled up next to the officers and a gunman opened fire, hitting the detective in the upper body. That second officer was not injured.
"He was wearing a vest," said Long Beach Police Chief Jim McDonnell at a news conference. "The injury he sustained missed the vest and fortunately the nature of the injury is that he's going to be OK down the road."
A nearby patrol officer who happened to be in the area heard the shots and fired back at the culprits, but they got away in the car. It's unclear if any of them were shot.
The wounded detective, a seven-year veteran of the force, was taken to Long Beach Memorial Hospital with what were believed to be non-life threatening injuries to his upper body. He was reported to be in stable condition.
As many as 70 officers canvassed MacArthur Park searching for the suspects. Police found what they believed to be the getaway car just a few blocks away from the scene of the shooting. The car had several bullet holes.
Anyone with information is urged to call Long Beach police at (562) 570-7260.