The Zhuhai Intermediate People's Court found the 25-year-old Vietnamese man surnamed Cao guilty of killing a Chinese man in Zhuhai City in 2014.
He was also ordered by the court to pay a total of 38,751.6 yuan in compensation to the prosecutor.
Cao entered China in November 2013 and started working for a pharmaceutical factory in Baijiao Township in Doumen District of Zhuhai.
The manager of the factory, a 39-year-old man nicknamed "Agang," helped register him under a fake Chinese name, state- run Xinhua news agency reported.
He was caught at the Zhuhai bus station on his way back to Vietnam, the court said.
Further investigation showed that the factory has hired several illegal workers from Vietnam.