A scuba diver who spent eight hours in shark-infested waters off Australia survived the night-time ordeal after swimming 22 kilometres to shore, rescuers said on Friday.

There are a handful of shark attacks on people off the coast of Western Australia every year, according to conservation groups.(AP file)

A scuba diver who spent eight hours in shark-infested waters off Australia survived the night-time ordeal after swimming 22 kilometres to shore, rescuers said on Friday.

The 46-year-old man, whose name has not been released, lost track of his boat when the anchor broke while diving with a friend about 12 nautical miles off the coast of Geraldton in Western Australia late Thursday.

His friend found the boat but the man failed to return. Rescuers searched the area after the alarm was raised but found no sign of the missing man, Western Australia Police said in a statement.

The man managed to swim to shore in the early hours of Friday after seeing torch lights on a small beach. Family members who had been searching for the man in the area found him a short time later.

“The wind was blowing 20 to 25 knots from the south and the water can get very confusing out there,” Geraldton Volunteer Marine Rescue Group spokesman Ian Beard told the Western Australian newspaper.

“He would have been borderline hypothermic by the time he got to shore. He should go out and buy himself a book of lotto tickets.”

“He’s very, very lucky to have made it ashore... (the wetsuit) stopped him from getting hypothermia,” Beard told the Australian Broadcasting Corporation.

There are a handful of shark attacks on people off the coast of Western Australia every year, according to conservation groups.

Local media reported this week that a fisherman in Geraldton had caught a 3.85-metre hammerhead shark, and two years ago a great white shark was found dead on a nearby beach with a sea lion stuck in its throat.

The tale of survival came less than a week after a diver was plucked to safety after drifting more than 30 miles from his boat following a solo dive at the Yongala wreck on the Great Barrier Reef.