Several people tried to help the surfer and fought off the shark before taking the injured man to shore at Salt Beach in South Kingscliff, police said.
He was given first aid for serious injuries to his left leg but died at the scene.
Nearby beaches were cleared of swimmers and surfers and will remain closed for 24 hours.
Kingscliff resident Stuart Gonsal had just arrived at the beach ready for a surf, when he found out about the fatal attack.
“We came down and we hadn’t got in the water and police were immediately hauling people in,” Mr Gonsal told ABC radio. “We found out there was a fatal shark attack on the south side of the rock wall. We were going to get in, we’re not going to now for sure.”
It was at least the third fatal shark attack in Australia this year.
In January, a diver was killed near Esperance off the Western Australia state coast. In April, a shark fatally mauled a 23-year-old wildlife worker on the Great Barrier Reef.