The pipeline runs along a coastal highway, and its leak sullied waters at Refugio State Beach, said Coast Guard Petty Officer Andrea Anderson.
The leak — which began around midday — affected a pipeline operated by Plains All America Pipeline, which was able to address the issue completely by 3:00 pm, the Coast Guard said.
Specially trained cleanup crews tackled the spill. In addition to the Coast Guard, California emergency services and Fish and Wildlife staff were on the scene as well as ExxonMobil representatives, the Coast Guard said.
Exxon has operations near the pipeline.
The spill was estimated at 21,000 gallons (80,000 liters) of oil, local media reported.