An Indonesian boy has required lifesaving surgery after being impaled in the neck by a flying needlefish.

Muhammad Idul was fishing with his parents in Buton waters off the South East Sulawesi province on Saturday when a needlefish jumped out of the water.

The fish's long slender snout sliced straight through the 16-year-old's neck and pierced the back of his skull.

The student was rushed to hospital for treatment, before undergoing risky surgery to remove the fish from his neck two days later.

Muhammad Idul, 16, had a narrow brush with death after he was stabbed by a needlefish

Graphic photos which have gone viral on social media show how the fish pierced all the way through Muhammad's neck from under his chin right through to the back of his skull.

The delicate two-hour operation involved three surgeons and two anesthetists on Monday.

'To remove the fish snout, one must be very careful because there is a large vessel in the neck, Professor Dr Syafri K. Arif told local news site Makassar Terkin.

Muhammad is recovering well but remains in hospital due to infection risks.

Graphic photos show how far the needlefish pierced right through to Muhammad's skull

'The child is relatively stable, but at present, the patient is still feverish,' a hospital general director told Antara News.

'We will wait for the fever to subside. Hopefully the fever won't rise.'

Television show IFish described the graphic photos as 'worst nightmare material right here,' when they were shared on its Facebook page.

'Amazing he survived,' one person commented on the Facebook post.

Another added: 'What a pain in the neck!'

Needlefish are distinguished by their long, slender jaw which bears multiple sharp teeth capable of inflicting deep wounds.

They are also adept jumpers renowned for leaping out of the water at up to 60 km/h.

The needlefish (pictured) was removed in a delicate procedure two days after the attack

There have been two known fatal needlefish attacks around the world, while several others have been seriously injured.

A 10-year-old Hawaiian boy died while fishing at night with his father in 1977 after he was attacked by a needlefish which pierced his eye and brain.

Thai navy cadet Kriangsak Pengpanich, 22, died in December 2018 when a needlefish speared through his neck during a training exercise.