Seven more people were wounded in the incident at around 9.30pm on Friday in the town of Isla Vista near the campus of the University of California at Santa Barbara.
The Santa Barbara County Sheriff, Bill Brown, described it as a premeditated atrocity.
"This incident appears to be a mass murder situation," Brown told a televised news conference. "We currently have seven people confirmed dead, that includes the suspect and six victims."
Witnesses reported seeing a black BMW speeding through the town and spraying bullets at people and other targets. Police said there were nine crime scenes as a result of the shooting.
Isla Vista is a pleasant beachside community which is home to many college students and has a reputation for its lively parties.
Brown said investigators know the suspect's name but will not release it before all relatives are notified,
He said police were familiar with a YouTube video entitled Elliot Rodger's Retribution, in which a man says he is aged 22 and vows revenge on women, with whom he says he has never had an intimate experience.
Peter Rodger, assistant director of the film The Hunger Games, believes his son - who was born in Britain - was the attacker, his lawyer said.
Witness Xavier Mozejewski said the incident was like an "old western shoot-out."
College student Brad Martin told a University of California student newspaper that his girlfriend was "absolutely hysterical" after being approached by the gunman. He said she was initially unsure his gun was real. "She said the next second he raised it up to her face ... and she turned around and started running. That's when she heard 'bang, bang, bang' right behind her as she was running."
The sheriff said deputies twice exchanged fire with the gunman before his vehicle crashed. He was found dead inside from a gunshot wound to the head and officers recovered a semi-automatic handgun from the car.
"We have obtained and are currently analyzing both written and videotaped evidence that suggests this atrocity was a premeditated mass murder," Brown said.
The sheriff described the shooting as "obviously the work of a madman."
He could not immediately say whether the suspected gunman was killed by deputies in the exchange of fire or died of a self-inflicted wound, nor did he say whether the gunman was a student.