Three anglers have narrowly avoided being impaled by a marlin while struggling to reel the flailing fish into their boat on New Year's Day.

Footage of the fishermen posted on Facebook by Conor Cogan shows them reeling in the fish aboard their boat, The Pump, off the coast of Port Stephens in New South Wales.

The marlin can be seen struggling with the line when it turns around and heads towards the anglers, with the marlin's bill narrowly missing Mr Cogan.

"[It's] pretty much as close as it gets," Mr Cogan wrote on his post.

Peter Constable, who was also on the boat at the time, also commented on the post, saying the incident "happened so fast, it was crazy".