The shootings took place just three miles away from where President Barack Obama was scheduled to attend a fundraising event. The Secret Service said the incident was believed to be unrelated to the president’s visit.
Police said the gunman used an AR-15-type assault rifle and had other weapons as well as handguns. They have not established a motive for the bloodshed.
Santa Monica Police Sgt. Richard Lewis said the gunman killed two people at a residence and two others at separate locations before he was shot and killed in a library at Santa Monica College.
Earlier, Police Chief Jacqueline Seabrooks said that investigators were combing as many as three crime scenes.
Authorities initially responded shortly before noon to reports of a blaze at a home fewer than 20 blocks away from the campus. Responding officers found two people believed to have been fatally shot by the gunman inside the flame-engulfed structure, Seabrooks said. Neighbors told NBC Los Angeles that the shooter is related to the people who lived there.
The gunman is believed to have moved west toward the college, firing at passing vehicles. More shots were fired when the gunman attempted to carjack a passing vehicle, law enforcement sources told NBC News.
Marta Fagerstroem, a student at the college, told NBC Los Angeles that she was on a bus that was stopped at a red light when the gunman stepped out from the passenger side of the car and fired five or six shots at the bus.
"This guy just steps out with a big rifle and starts shooting," Fagerstroem told the station. A woman in the back of the bus was bleeding from her head, she said.
Attempting to evade officers, the gunman ran onto the college campus and entered a library, where he shot at multiple people, police said. As students scattered, officers entered the library and shot and killed the gunman, the said.
Seabrooks said at an evening news conference that "as many as six" people had been killed during the rampage, but Lewis later said that the toll had been revised to five, including the gunman.
Lewis said five people were injured in the shooting, including one in critical condition, one in serious condition and three with minor wounds.
The gunman has yet to be identified by authorities, who said the coroner's office would do so after conducting an autopsy. He was described as a male Caucasian between the ages of 25 and 30. He was dressed head to toe in black and sported what authorities said appeared to be a bullet-proof vest.
Obama was in Santa Monica for a Democratic National Committee event at a private home at 2 p.m. (5 p.m. ET). A spokesman for the Secret Service said the agency was aware of the incident but said it was being treated as "a local police matter at this point."