Doctors are trying to save a spearfisherman's arms after he was mauled by a shark while trying to fight it off in waters off Yeppoon in central Queensland.

The 31-year-old was diving off Miall Island, near Great Keppel Island, when a three-metre-long shark attacked him head-on just before midday on Saturday.

The man has told the Queensland Ambulance Service he was in a school of mackerel in three-metre-deep water when the shark appeared.

Ambulance officer Brad Miers said the man punched the shark repeatedly until it left before he was able to swim back to the boat.

"He is in a serious but stable condition at the Rockhampton Hospital but he has received quite severe injuries to his upper limbs," he said.

"He has got multiple wounds to his upper limbs.

"It seems like he has tried to fight the shark off for a considerable amount of time."

Mr Miers said he had been in the ambulance service in the area for 25 years and had never heard of a shark attack.

"Some of our veterans with the coast guard have been in this area for a long time and they can't recall a shark attack — it is a very isolated incident," he said.

Yeppoon Coast Guard deputy flotilla commander Paul Florian said the man was helped back into his boat by friends following the attack.

"The Coast Guard boat happened to be nearby because it was out doing a training run," Mr Florian said.

"We transferred the person to the Coast Guard boat and then transported him back to the pontoon at Rosslyn Bay Harbour, where they were met by paramedics."

He was treated on the scene before being taken to Rockhampton Base Hospital by road.

The man will receive treatment for his injuries in Brisbane.