Media said there were also two blasts and that 28 people had been injured.
This is the second attack in a month in Xinjiang, which is home to a Muslim Uighur minority and has seen periods of ethnic tension.
A local official was quoted as saying that both attackers were Uighurs.
"The case is still under investigation so I don't have more information," Hou Hanmin told AFP news agency.
Ethnic unrest According to tianshannet.com, a Xinjiang government-run website, the assailants hijacked a truck waiting at traffic lights, stabbing the driver to death before ploughing the vehicle into bystanders.
They then got out of the vehicle and started attacking people at random, the report said.
It said the crowd then turned on the men, killing one of them. The second man was captured.
State-run news agency Xinhua said the attack had been preceded by two explosions.
Twenty-eight people were reported to have been taken to hospital.
On 18 July, several police officials and a number of civilians were killed in an attack on a police station in the city of Hotan.
Chinese officials blamed the attack on "terrorists" from the Uighur minority.
Uighur activists said the security forces had provoked clashes by opening fire on a peaceful demonstration.
The majority of Xinjiang's population is ethnically Uighur - who are Muslims with strong cultural ties to Central Asia.
The BBC's Martin Patience in Beijing says many Uighurs are unhappy about what they say is the repressive rule of Beijing and are angered by the migration of the majority Han Chinese to the region.
In 2009, riots erupted in Xinjiang in which nearly 200 people died after tensions flared between the Uighurs and the Han.