The total toll makes the incident by far the bloodiest since rioting involving Uighurs and members of China's Han majority killed around 200 people in the regional capital Urumqi in 2009.
Police had arrested 215 "terrorists" while 13 civilians were also wounded in Monday's attack on a police station and government offices in Shache county, or Yarkand in the Uighur language, in Kashgar prefecture, according to the official Xinhua news agency.
It was the latest in a series of violent incidents over recent months in and connected with the vast resource-rich region, where rights groups accuse China's government of cultural and religious repression they say fuels unrest.
News of the clash first emerged late on Tuesday when Xinhua reported that dozens of people had been killed or wounded by knife-wielding assailants.
In its report Sunday, Xinhua said that 35 of the dead civilians were Han Chinese while two were Uighurs.
"A gang armed with knives and axes attacked a police station and government offices," it said, with some later moving on to another township, "attacking civilians and smashing vehicles as they passed".
"The gangsters also set roadblocks and stopped vehicles passing by, before slashing passengers indiscriminately and forcing civilians to join them in the terror attack," it added, citing police.
Officers had confiscated knives from the scene as well as "banners that hailed holy war".
The news agency cited the government as saying investigations showed the attack was "organised and premeditated", and "in connection with the terrorist group East Turkestan Islamic Movement" (ETIM).
Information in Xinjiang, in China's far west, is often difficult to verify independently, and many foreign analysts doubt ETIM's capacities.
Dilxat Raxit, a spokesman for the exiled World Uyghur Congress (WUC), accused Beijing's security forces of using submachine guns and sniper rifles, leading to "huge casualties".
"China has distorted the incident and claimed terrorism in order to cover up the truth, which is that they opened fire to repress Uighurs," he said in a statement emailed to AFP.
- Series of attacks -
Beijing has blamed violent separatists from Xinjiang for a series of attacks which have grown in scale and sophistication over the last year and have spread outside the region.
Among the most shocking were a May assault on a market in Urumqi, where 39 people were killed, and a deadly rampage by knife-wielding assailants at a train station at Kunming in China's southwest in March, which left 29 dead.
The violence has also included a fiery crash at Tiananmen Square, Beijing's symbolic heart, in October, that killed two tourists and the three people in the vehicle, all from the same family.
On Friday, police in Xinjiang shot dead nine suspected terrorists and captured one, according to Xinhua.
That came two days after Jume Tahir, the government-appointed head of the Id Kah mosque in Kashgar, the largest in China, was killed after leading morning prayers.
Tahir was murdered by "three thugs influenced by religious extremist ideology", the Xinjiang government web portal Tianshan reported.
He was killed the day after China's Muslims celebrated the Eid festival that marks the end of the fasting month of Ramadan.
According to Raxit, Tahir "consistently cooperated with the government" and "local Uighurs suspected he had a special relationship with the Chinese ministry of security".
Last week, Chinese authorities formally charged Ilham Tohti, a Uighur economics professor detained earlier this year, with separatism, which can carry the death penalty.