The incident unfolded just after 9:30 p.m. Saturday after deputies responded to a Vons store along Carnelian Street, near 19th Street, for reports of a man with a gun.
Gloria Huerta, public information officer for the San Bernardino County Sheriff's Department, says deputies encountered the suspect outside a Walgreens across the street and there was an exchange of gunfire.
The unidentified suspect then made his way inside a the Sprouts grocery store in the same shopping center and "a lethal force encounter occurred."
He was shot and taken to the hospital, where he later died. No injuries to deputies or bystanders in the area were reported.
Huerta said it's unclear what the man was doing with the gun in the area.
The shooting prompted a thorough investigation that lasted overnight into Sunday. Video from the scene showed deputies canvassing the area as crime-scene tape blocked off a part of the parking lot. One of the store's glass doors was shattered.