A man died after a shark attack in northern Queensland state on Sunday, the third fatal shark attack this year in Australia.

The 39-year-old man died from a critical head injury after he was attacked while spearfishing at Kennedy Shoal, an offshore reef, Queensland police said.

"He was retrieved from the water by another person who was in the water with him at the time of the attack," Queensland Police Inspector Elaine Burns said in a news briefing.

"That's quite a terrifying thing to see happen in front of you," she added.

Police were providing support to three men who called the coast guard for help from a private boat just before noon (0200 GMT), and then travelled over an hour with their injured friend to shore.