Australia shark shoreline
In a separate incident, a shark is spotted off the coast of Australia in this related photo

A 25-year-old British man managed to escape a terrifying encounter with a shark while surfing in Australia by "punching it in the face".

Charlie Fry, a doctor who recently moved to Australia for work, was surfing at Avoca beach, north of Sydney, when a shark jumped out of the water and bit him, The Telegraph reported. Fry told reporters he heard a "massive thud," which he initially attributed to his friends.

When he turned around, Fry said he "saw a shark's head come out of the water with its teeth".

"I turned to the right and I saw a shark's head come out of the water with its teeth and I just punched it in the face," he told Nine News. "[I] got back on my board, shouted at my friends who were there and then managed to catch a wave in. So it was a bit of a close call."

Fry said he learned the technique from professional surfer Mick Fanning. The doctor watched a YouTube video featuring an interview with the Australian surfer, who punched a shark to survive an attack during a competition in South Africa in 2015.

"Me and my friends have just started surfing, and we saw the YouTube clip of Mick Fanning saying he punched [a shark] in the nose," Fry said.

"So when it happened I was like, 'Just do what Mick did, just punch it in the nose.'"

Fry added: "If you are watching or listening, Mick, I owe you a beer. Thank you very much."

According to The Telegraph, Fry suffered minor scratches and bite wounds. He was taken to hospital by his fellow surfers, who are also doctors. A 10-foot shark was later spotted by a rescue helicopter service near the site of the attack.

"I didn't feel the teeth going in, it felt like I was smacked, it felt like a hand, a hand grabbing me, shaking me," Fry said.

"I didn't really notice it at the time, because when you're surfing, all I was thinking was 'I'm about to die', and I was just ... thinking about getting in [to shore] as fast as possible. You just ride the wave as long as you can and start paddling for your life."

Fry said he would take time off but will return to surfing at a different spot. The beach at Avoca was closed by authorities, who said they are closely monitoring surrounding beaches.