A 19-year-old bodyboarder was killed on Friday in a rare shark attack a short distance off a California beach, when the animal pulled him under and inflicted a "massive wound," police said.

Authorities closed local beaches for 72 hours after the attack by a shark described as up to 6.1 metres long.

The victim, identified as Lucas McKaine Ransom, "was boogie boarding on the break line about 100 yards off the beach with his friend when a shark suddenly pulled Ransom under the water," said an updated statement.

"Ransom suffered a massive wound to his left leg and appeared to die shortly thereafter," added the the Santa Barbara County Sheriff's Office, noting that witnesses said the shark was between "14 and 20 feet (4.3-6.1 metres) long."

The attack occurred at Surf Beach at Vandenberg Air Force Base (VAFB) near Santa Barbara, which is some 215 kilometres north-west up the Pacific coast from Los Angeles.

Following standard protocol, VAFB has ordered the closure of all base beaches for the next 72 hours, while local authorities are posting warning signs at nearby beaches.

Earlier police had said the victim was in his early 20s and was in the water with a friend at the time of the attack. Officials were "working to identify the type of shark," they added.

The last death of this kind involved a great white shark in California in 2008, when a 66-year-old man was attacked as he swam with friends off a beach in San Diego.

- AFP