A fish-out-of-water from Brooklyn who wanted to catch a few good waves off Cape Cod got the “shock” of his life with a way-too-close encounter with a great white shark.

En route to a Maine wedding, Devon Zimmerman, 30, had taken a detour to surf off Nauset Beach early Friday when he heard something in the water and assumed it was nothing to worry about.

“I had very literally just gone through the surf and was laying on my board between sets, and you know, there was this eerie quietness to it and then I heard this rustling in the water,” the California native told the Boston Globe. “So I looked over my shoulder and thought maybe it was a seal emerging.”

It was no seal.

“It didn’t really register to me until I saw the dorsal fin pop up, and then it was kind of immediate shock,” Zimmerman told the newspaper. “There was nothing I could do other than let it swim past me. I froze on my board, and then lifted my feet out of the water and just waited.”

Luckily, the shark “just kept on swimming,” Zimmerman recalled.

After getting back on shore, Zimmerman met several people who spotted the too-close encounter, including a photographer who was hoping to get shots of surfers taking advantage of Hurricane Humberto remnants stirring up sizable waves.

“It was within feet of him,” Jim Mault, who owns Orleans Camera, told the newspaper.

Mault said he had shouted a warning toward Zimmerman and kept on shooting as the surfer made his way back to shore.

“It was definitely tense,” Mault told WCVB. “He very calmly turned over, then paddled back in.”

Mault’s photo — which clearly shows the shark’s large fin as Zimmerman turned his head to check out the commotion — went viral Friday as the Orleans Department of Public Works and Natural Resources and the Atlantic White Shark Conservancy shared his startling shot.

“A reminder to all beachgoers, as we continue into peak season for white shark activity,” the municipal agency posted on Facebook. “Please remain vigilant.”

Zimmerman, who could not be reached for comment Tuesday, told WCVB hours after the incident that he hadn’t felt “calm and collected” since the chance meeting. But he plans on possibly getting back into the water off Massachusetts on Wednesday — just not off Cape Cod, he told the Globe.

He already got back in the ocean over the weekend in Maine, where he constantly relived his brush with the mammoth predator.

“It’s indescribable,” Zimmerman told the Globe. “I feel like, on our drive up to Maine, all I could keep saying to myself was, ‘It’s just so big.’ You don’t actually get a sense of its scale. It’s an awesome animal in sort of the most terrifying way.”