"It came up and got stuck in my leg rope," he said in a television interview afterwards.
"I was kicking and screaming. I just saw a fin. I didn't see teeth. I was waiting for the teeth to come at me as I was swimming. I punched it in the back."
Fanning, a triple world champion nicknamed White Lightning, was sitting on his board in the water when the shark lunged at him, tipping him off the board.
He was taken out of the water by safety crews, and said he had only lost his leg rope.
"We've never seen anything that dramatic and that frightening," commentator Joe Turpel was quoted as saying.
The competition was abandoned after the incident.