The attack occurred just before 7 a.m. during the opening hour of California's popular spiny lobster season.
The boy was attacked in about 9 feet of water approximately 150 yards offshore. He was brought to shore by three bystanders, Giles said. Emergency responders arrived, and the boy was flown by helicopter to a trauma center.
"He was conscious, he was above water, and the bystanders were able to get him up on the beach ... and he was talking all the way to when he was being transported," the captain said.
The three rescuers were identified only as an off-duty police officer from nearby Oceanside, an off-duty state lifeguard and a friend who were also diving for lobsters. Giles said the trio provided a "tremendous amount of aid to that young man."
Witnesses estimated the shark was about 11 feet long, but the type was not known, he said.
Lifeguards immediately turned to clearing people out of the water. Giles noted there were multiple other divers in the area. The waters off about 4 miles of beach were ordered closed for 48 hours, and a nearby surfing competition was canceled before it got underway.
Lifeguards were being brought in from various agencies while a San Diego County sheriff's helicopter scouted from the air. But in the immediate hours after the attack, there was no sign of shark activity or signs of typical prey such as seals, dolphins and porpoises, although a seal was reported in the area earlier, Giles said.
"This is a nonfatal incident; we don't want anybody else getting injured," he said.