An amateur explorer who spent six days clinging to an underground ledge in Hungary was rescued on Thursday.

Zsolt Szilagyi, 26, was trapped in an air pocket on Saturday. Rescuers blasted a new tunnel through 10 metres of rock to free him.

Suffering exposure and dehydration, Szilagyi was taken to hospital following his rescue.

Szilagyi was separated from his companions in the Rakoczi cave complex about 230 kilometres north of Budapast on Saturday.

A rope linking him to his friends broke, and Szilagyi wandered into a waterlogged passage. He found an air pocket and climbed onto a small ledge, where he stayed.

He wasn't found in the maze of underground passages until Tuesday, despite a search that was begun within hours.

By that time he was too weak to swim out through the water, so divers brought him food while a new passage was created through the rock using drilling equipment and explosives.