Three knife-wielding assailants who attacked staff at a Communist Party office in China and set off an explosive device, killing two and injuring three others, have been shot dead by police, an official Chinese news agency has reported.

The incident, which occurred in China's far western region of Xinjiang on Wednesday afternoon was the first such publicly reported fatal attack in months in Xinjiang, where information is strictly controlled by authorities and reporting access has tightened over the past couple of years.

Authorities have blamed the attacks on radicals among the mostly Muslim, Turkic-speaking Uighur ethnic minority seeking independence from Beijing.

Three "rioters" drove into Moyu County's Communist Party courtyard in a vehicle, attacked workers with knives and detonated an explosive device, the Xinhua News Agency reported, citing the Ministry of Public Security.

It said an official and security guard were killed. A ministry press officer, who would only identify herself by her surname, Wang, confirmed the information in the report.

The attack could not be independently verified.

Security crackdown 'could be radicalising some' Uighurs

Xinjiang has been under heavy security since deadly riots in 2009 that pitted Uighurs against ethnic Han Chinese migrants.

Those measures were tightened further following a wave of attacks in Xinjiang and other parts of China blamed on Uighur separatists.

In November 2015, police killed 28 people who authorities said had killed 11 civilians and five police officers at a remote coal mine in Asku controlled by members of China's Han majority.

Some critics say the violence in Xinjiang stems from government policies that have marginalized the Uighurs, and also warn that Beijing's harsh crackdown may be radicalising some Uighurs.

Dilxat Raxit, spokesman for the Munich-based World Uyghur Congress, which advocates Uighur rights, said authorities were provoking and suppressing Uighurs and then choosing to "suppress the resistance with violence".

"I strongly question the cause of the incident and casualty toll owing to the lack of transparent reporting in official media," he said in a statement.

AP