PORTLAND, Ore. — Joseph Tanner was resting his arms on his surf board, his lower body dangling in the water, when something grabbed his right leg and yanked him under the waves.

In an instant, Tanner knew he was being attacked by a shark in the chilly waters off the northern Oregon coast and he wondered if he would die, he recalled Wednesday, nearly three weeks after the Oct. 10 attack north of Cannon Beach.

The shark had his leg in its jaw — a bite that would later measure 26 inches from his upper thigh to his ankle — and as Tanner struggled to break free, he remembered that he should try to punch the shark in the nose or poke it in the eye.

“I opened my eyes and there were gills in front of me. I can’t reach the nose and I can’t reach the eyeballs, so I just started hitting the gills,” said the 29-year-old.

The shark released him and he screamed a warning to his friends who were surfing about 40 feet away, then began paddling to shore on his board.

He was terrified the shark was following him, tracking him by the blood streaming from his mangled leg.

Joseph Tanner exhibits his still-healing injuries to his legPhoto: AP

Friends later told him he paddled about 200 yards — a five-minute ordeal — before catching a wave and riding it in for the last 40 yards, he said.

“I just paddled my life away. That was probably the scariest moment, trying to get back to the shore and leaving a trail of blood,” Tanner said. “I couldn’t lift up my arms anymore and I just rolled off my board in six inches of water and people came from all over.”

Tanner, a critical care nurse at Legacy Emmanuel Hospital’s intensive care unit, immediately began telling his rescuers what to do.

He directed them to make a tourniquet from a T-shirt and, when that wasn’t tight enough, he told them to make another out of the leash from his board.

Six people used a surfboard like a backboard and carried him up a steep slope and over rocky ground to the parking lot above.

While they waited for help, Tanner had them call the ambulance and provide his blood type in case he needed a transfusion.

He also told them to cut off his wetsuit so paramedics could start an IV when they arrived.

All the while, Tanner could feel himself getting weaker, he recalled.

Joseph TannerPhoto: AP

“I started getting lightheaded and that freaked me out because I know that’s the first sign of shock,” Tanner said.

When paramedics arrived, Tanner insisted that the rescue helicopter fly him to Legacy Emmanuel, where he knows the trauma staff.

“I remember being in the trauma bay and two of my co-workers were on either side of me. They were in drapes and lights and they literally looked angelic. It was like a breath of relief to see these familiar faces,” Tanner said.

He required three surgeries and will need physical therapy, but the shark missed his bone and key nerves.

No one got a good look at the shark, but Tanner said he’s been told by several experts that it was likely a great white, based on the jaw mark on his leg.

As he recovers, Tanner hopes other surfers can learn from his experience.

All surfers should know how to tie a tourniquet and know their blood type — and a thick wetsuit doesn’t hurt, he added.