The spill came from a valve on a pipeline owned by Crimson Pipeline which had been replaced the day before.
The pipeline burst at about 6:30 a.m. in the Hall Canyon area just north of Ventura, and an estimated 700 barrels of crude oil flowed about half-mile into the Prince Barranca, a ravine that ends at San Buenaventura State Beach near the Ventura Pier.
Natural catch basins in the Prince Barranca helped stop the oil from going into major ocean waters.
"We were able to do a damming and diking operation with our agencies working together and stopping the flow of oil from making it even to the city, much less down to the ocean," said Chief David Endaya, with Ventura City Fire.
A nearby pump house was shut down to try and stop the flow from going into the ocean, and the oil did not reach a beach as of Thursday afternoon, Ventura Fire Department spokeswoman Kelly Flanders said.
County health officials said the area is safe for people, but state officials expect to be studying the effects on wildlife and the environment for some time.
Officials first reported up to 5,000 barrels of oil were at risk of reaching the ocean but later adjusted the number to 700.
The crude oil flowed behind a hill of homes, sparking a strong foul odor among neighborhoods in the area.
"Kind of had an idea of what was going on. I didn't want to know, then I heard the trickling. And then I finally got out of bed and kind of realized my worst nightmare, and there's the oil," said Kirk Atwater, a nearby resident.
Ventura County fire officials visited homes to check for air quality conditions, and did not issue any evacuations. Officials said it was safe for all residents to be in the area.
The spill comes 13 months after a coastal pipeline about 55 miles to the west in Santa Barbara County leaked more than 120,000 gallons of oil, some of which flowed into the ocean and created a slick that killed birds and sea lions.
That pipeline, owned by Plains All American Pipeline, was found to have been corroded.
The Associated Press contributed to this report.