The incident happened inside a Ralphs supermarket in a shopping center at Balboa Boulevard and Devonshire Street just after 6:30 p.m.
Police were called to the store on a report of an armed man causing a disturbance inside. There were also reports of customers being assaulted. Video taken before the shooting shows the shirtless suspect standing on top of a store refrigerator display yelling at several officers in the store.
"They did determine that he was armed," LAPD Commander Alan Hamilton said. "There was a confrontation with the officers and an officer-involved shooting occurred."
The suspect then fled out the Ralphs and ran to an Arco gas station across the street. Police called for additional units and surrounded the store. Within less than 45 minutes of the initial shooting call, the suspect emerged and surrendered to officers.
Police say officers later recovered a gun at the gas station. It was not immediately clear if that was the gun that fired the bullets which struck the officer.
The Los Angeles Fire Department transported the officer to a local hospital to be treated for a gunshot wound.
The suspect was also transported to a hospital for evaluation.
The officer's wounds were not considered life-threatening.
Later Sunday night Chief Michel Moore said the officer had been released from the hospital.
"Officer out of hospital with sutures to hand. Grateful," the chief tweeted.