A diver had a lucky escape when he was trapped in a cage underwater with a great white shark.

The incredible footage shows the shark swimming towards a piece of tuna on a rope before lunging through a small gap in the cage where a diver was filming.

Tense moments then follow as the shark is seen thrashing around inside the cage as people on-board the boat look on helplessly, off the west coast of Mexico.

This footage of the incident was posted on YouTube by Gabe and Garrett

The diver emerges from the cage unhurt after the great white escapes Credit: YouTube/GabeandGarrett

A description on Facebook said that despite the footage appearing to show the shark attempting to attack the cage, this was not the case:

It said: "So this shark lunged at the bait, accidentally hit the side of the cage, was most likely confused and not able to swim backwards, it thrust forward and broke the metal rail of the cage."

A member of the crew rushes to open the top of the cage and attempts to pull the diver out as the shark thrashes around.

The apparently injured shark then appears at the entrance to the cage and manages to swim over the top and back into the open water.

In the video onlookers can be heard asking if there was anyone inside the cage, before the diver emerges holding a camera looking shaken and relieved.

The footage was filmed by a father who usually posts videos of the adventures of his children to YouTube.

"This is not our normal type of video. I (their dad) went on a great white shark cave diving trip.

"[Sharks] are temporarily blinded when they open their mouths, so when the shark went for the tuna bait on the rope it accidentally slammed into the cage. These sharks are amazing creatures to be seen up close!"