Some 21,000 gallons (79,000 litres) of oil spilled into the ocean and on beaches before it could be secured after a pipeline ruptured along the scenic California coastline on Tuesday, a US coast guard spokesman said.