A priest and several churchgoers have been injured during a machete attack on a church in the Indonesian city of Yogyakarta.

A 22-year-old man armed with a sword or machete attacked members of the congregation at St Lidwina Church.

The priest was struck in the back of the head and several others were injured before the man started hacking at a statue of Jesus and Mary.

The priest and injured churchgoers were transported to hospital. ( Supplied )

A patrolling police officer ran into the church and tried to negotiate with the attacker.

Police said the attacker charged at the officer, who shot and injured him.