A man has fought off two intruders who attacked him with a machete during a home invasion north of Brisbane.

A man has used a fire extinguisher to fight off two intruders armed with a machete and a shotgun north of Brisbane.

Police say the intruders used a shotgun to smash their way into a Petrie home on Monday night, then hit a 31-year-old man inside with a machete when he put up a struggle.

The victim used a metal rod and a fire extinguisher to defend himself, but was struck again with the machete when he tried to ward them off.

“He kept swinging the fire extinguisher at the men until they retreated from the house and fled on foot,” police said.

A woman in a bedroom was unharmed.

The victim needed hospital treatment for cuts to his head, hand and upper arm, a possible broken thumb, and cuts to his feet from broken glass.

Police are still searching for his attackers.