Xinhua described the raid, which happened in the town of Kashgar at 7:55 a.m. (23:55 GMT Sunday), as a terrorist act.
The attackers used two trucks to smash their way into the base, where troops were engaged in morning exercises. The assailants leapt out and threw two hand grenades into a group of police, killing 16 and injuring 16 more.
Five of the attackers were killed, while two were arrested after being injured. The detained men said they wanted to unleash a jihad against ethnic Han Chinese, Xinhua reported.
The autonomous Xinjiang province is home to many of China's Muslim Uighur minority, elements of which have engaged in a decades-long rebellion against Beijing's rule. There is general resentment among much of the Uighur population for the economic - and growing cultural - dominance of Han Chinese, many of whom have migrated to the region in recent years.
Since the start of the year, Chinese authorities say they have eliminated 12 terrorist groups in Kashgar, a region in the far west of Xinjiang bordering several countries including Afghanistan and Pakistan. Some groups there seek to establish an independent "East Turkestan" and are accused of links to Al Qaeda.