Two men have survived a shark attack off Dunsborough on the south-west coast of Western Australia.

The pair were in an inflatable boat near Castle Rock when a shark targeted it, shortly after 5:00pm on Saturday.

The boat was punctured in the attack but the men made it to shore without injury.

The beach was closed after the incident.

Police and WA Fisheries officers are investigating.

It is the second shark attack in West Australian waters this month.

Sean Pollard, 23, lost both hands and part of an arm in an attack at Wylie Bay, near Esperance, on the state's south coast.

After that attack, the Fisheries Department laid drum lines and killed two great white sharks in the area.