The man lived for 16 hours, stuck in an overturned boat in the Atlantic Ocean off the coast of Spain.

The Coast Guard said the 40-foot (12-meter) yacht Jeanne SOLO Sailor issued a distress signal at 20:23 local time on Monday from a distance of 14 miles from the Sisargas Islands off the northwestern Spanish region of Galicia. Tracking data shows that he sailed from the Portuguese capital of Lisbon on the morning of the previous day.

As the rescue boat with five divers set sail, one of three search helicopters found the capsized boat as the sun went down.

A diver was lifted onto the ship’s hull looking for signs of life, and the man inside, who has not been named, responded to his blows to the hull by knocking from within.

As the sea was too rough to attempt an escape, they attached buoyancy balloons to the ship’s hull to prevent further sinking, and waited until morning.

Two divers swam under the boat to help the sailor, who was wearing a neoprene survival suit and submerged in knee-deep water.

Vicente Cobelo, a member of the Coast Guard’s Special Operations Team, told a local station that the man voluntarily jumped into the icy water and swam under the boat to reach the surface of the sea.

“On his own initiative, he entered the water and dived, with the help of divers who had to pull him out, because it was difficult for him to get out in a suit,” he said.

He was airlifted to safety and taken to a hospital for checkups, but was released without issue shortly thereafter.