A man leapt from his surfboard on to a shark that was attacking his wife, repeatedly punching the animal until it let go, Australian media report.
Chantelle Doyle, 35, was surfing off Shelly Beach at Port Macquarie, New South Wales, when the attack took place.
Her husband punched the shark until it released its grip and then helped Ms Doyle to the shore.
She was airlifted to hospital with serious injuries to her right leg.
Experts quoted by the Port Macquarie News believed Ms Doyle had been mauled by a juvenile great white shark up to 3m (10ft) in length.
Surf Life Saving NSW chief executive Steven Pearce praised the husband - named by media as Mark Rapley - for his quick action.
"This fella paddled over and jumped off his board on to the shark and hit it to get it to release her and then assisted her back into the beach," he said, quoted by the Sydney Morning Herald. "Pretty full on, really heroic."
Inspector Andrew Beverley, of Ambulance NSW, said people on the beach administered first aid to Ms Doyle before medics arrived.
"The bystanders on scene that rendered assistance should be commended. They did an amazing job," he said.
He added that it was the third serious shark attack on that stretch of coast in recent months.
Ms Doyle was flown to Newcastle Hospital for surgery and was in a stable condition.