Joe Tanner was paddling on his surfboard off the Oregon coast, waiting to catch a wave, when he felt something grab his leg.

It was a scenario any surfer or beachgoer would dread: Tanner looked down to find a toothy great white shark. The 29-year-old fought off the shark, punching it repeatedly in the gills until it let go, and escaping in what is being called an "incredible" feat.

Once Tanner reached the shore, he directed his own first aid, asking people to tie tourniquets to stanch the flow of blood from his wounds.

"I remember thinking, 'Thank God I made it to shore,'" Tanner told Live Science. "Then, the pain hit." [In Photos: Great White Sharks Attack]

Marine biologists are calling Tanner's escape extraordinary, saying that he did all of the right things, from punching the shark on its sensitive gills to directing his medical treatment until emergency help arrived. Granted, Tanner knew about first aid because he's a critical care nurse at Portland's Legacy Emanuel Medical Center.

"He's obviously incredibly lucky and incredibly cool under pressure," said Dr. Matthew Levy, an associate professor of emergency medicine at the Johns Hopkins University School of Medicine in Baltimore, who was not involved in Tanner's care. "It's one thing to be a lifesaver and save other people's lives as a nurse and health care provider, but another to have the mental discipline and nerves of steel to direct others around him as to what to do."

Robot shark

Tanner, a native of Coeur d'Alene, Idaho, began surfing while he was an undergraduate at the University of Portland in Oregon in 2006. He had experience snowboarding and wakeboarding, and found he could easily balance on a surfboard, catching waves and relaxing as he took in nature, Tanner told Live Science.

After graduating with a biology degree, he worked as a commercial fisherman in southeast Alaska, and afterward lived in Kenya, working at a medical clinic, and then India. "That was one of the best times I've ever had in my life," he said, remembering motorcycling across South Asia. Later, he returned to Portland to get his nursing degree.

On the sunny morning of Oct. 10, Tanner planned to go surfing with a friend at Indian Beach in Oregon's Ecola State Park. But his friend couldn't make it, so Tanner went by himself, surfing in the morning and taking a break in the afternoon. While resting on the beach, he talked with another surfer — ironically, about sharks, he said.

At about 4 p.m. local time, Tanner and the other surfer returned to the water in their wetsuits. "I had just gotten out there, paddling in the surf," Tanner said. "My feet were dangling in the water. All of a sudden, something grabbed my leg, and kind of took me off my surfboard and under."

His initial reaction was disbelief, Tanner said. When he opened his eyes, the shark looked like a giant wall before him, with the head to his left and tail to his right.

"I remember not seeing anything moving like a normal animal [would]," he said. "I had the thought, 'Why is there a shark robot in the water?'" [Photos: The Freakiest-Looking Fish]

Tanner thought that he would surely die. But, in a moment of clarity, he recalled that victims of shark attacks are supposed to punch the shark in the eyes or nose. "I couldn't reach the nose, and the eyes were pretty small targets," he said. "I saw gills in front of me, and they seemed pretty fragile, so I just started hitting and punching the gills."

Incredibly, the shark released Tanner. "I got onto my board and screamed at everybody to get out of the water because there was a shark," he said. Tanner was about 200 yards offshore, but with the other surfer nearby, he managed to make it back. All the while, Tanner worried that the shark would follow the trail of blood from his bleeding leg, he said.

Once Tanner reached the shore, people called 911, and he remembers asking them to tie a tourniquet on his right leg using the surfboard's leash. That was smart, Levy said, as "We know [severe bleeding] is the leading cause of death of trauma victims within the first 24 hours [of their injury]." [Here's What to Do in a Bleeding Emergency]

Six people carried Tanner on his surfboard to the parking lot. Once there, he asked them to remove the top of his wetsuit so that emergency workers would quickly be able to administer intravenous therapy. He also told them his blood type, and yelled at the top of his lungs, both with pain and as a way to cope, while people pressed down on his leg with towels, trying to curb the flow of blood.

Soon thereafter, police and then a helicopter arrived and flew him to Legacy Emanuel Medical Center.

Attack or curious shark?

Given that Tanner was on his surfboard on a sunny day, is it possible that the shark mistook his silhouette for a seal, one of its preferred meals?

Probably not, said Andrew Nosal, an assistant professor of biological sciences at Saint Katherine College in San Marcos, California.

The simpler explanation is that the shark saw something novel, and decided to test whether it could eat it, Nosal said. "Unfortunately for us, the shark can only test things with its mouth, so what might be a gentle test bite for a shark could be devastating for a person," he said. [7 Unanswered Questions About Sharks]

However, the shark likely wasn't expecting the novelty (that is, Tanner) to fight back. The gills are filled with blood vessels that are close to the skin's surface, and Tanner probably surprised the shark when he hit the vessels, Nosal said. Victims of shark attacks can also hit the sensitive eyes and the tip of the nose to surprise a shark, Nosal added.

Tanner was lucky that the shark didn't ambush and launch him into the air, as the predator often does with seals, said Christopher Lowe, a professor of marine biology at California State University, Long Beach.

Unlike other sharks, great whites (Carcharodon carcharias) are warm-blooded, which gives them the ability to swim rapidly toward prey, Lowe said. Their preferred meals — elephant seals and other marine mammals — are smart and nimble, and ambush attacks are one of the few ways great whites can catch them, he said.

It's a mystery just how many great white sharks live off the West Coast, but researchers reporting in a 2014 study in the journal PLOS ONE estimated that there were more than 2,000 swimming off the coast of California. Despite their numbers, shark attacks on people are rare, but more will likely happen in the coming years as shark populations increase, Lowe said.

C. carcharias' numbers are increasing because of environmental policies enacted over the past several decades that protect fish and marine mammals within U.S. waters, Lowe said. Young great white sharks eat fish, and adults eat marine mammals; as their prey become more abundant, so do sharks, Lowe said.

Perhaps the great white shark was swimming near Indian Beach because seals or sea lions were nearby hunting for salmon that was returning home to spawn that fall, Tanner and other experts said.

Hospital care

The shark ended up leaving a semicircle of 6-inch-deep punctures on the upper right part of Tanner's thigh. To repair the muscle and other damage to his leg, Tanner has undergone three surgeries.

Doctors now say he's expected to be walking again six weeks after his third surgery. Tanner hopes to return to surfing eventually. Rather than blaming the shark for the predicament, "I have no animosity toward it," he said. "We're in their territory, and that's a risk of surfing, no matter how rare it is." [On the Brink: A Gallery of Wild Sharks]

Nosal called Tanner's take "insightful."

"Just remember that there's no such thing as 'shark-infested waters,'" Nosal said. "Sharks live there; that's their home. You can't infest your own home. When we get into the water, we have to recognize that there are risks associated with that, just like there are risks getting into our cars and driving to work every day."

Get tips on avoiding shark attacks, such as steering clear of places where sharks and their prey are known to swim, in this Live Science article.

Tanner's family put together a GoFundMe fundraiser to help pay for his recovery. Any extra money raised will go to the Home of Hope orphanage in Zambia.