This is the third case of the bloody mass shootings in the United States in less than a month.
Four people, including a child, were killed in the shooting in an office building in the Los Angeles suburbs.
The suspect, who was injured in a shootout with police, was taken into custody, police said.
The bloodshed in the city of Orange, about 50 kilometers from downtown Los Angeles, was the third fatal mass shooting in the United States in less than a month.
The authorities did not comment on the possible motives of the gunman.
California Governor Gavin Newsom called the events in Orange “horrific and heartbreaking.”