Tanzania's parliament has approved a tough new law aimed at curbing foreign employment.
The bill requires firms to satisfy the authorities that no local could do the job before employing a foreigner.
It reflects growing resentment towards foreign workers in Tanzania, a BBC reporter says.
It did not "make sense to see a Chinese driving a commuter bus" in Tanzania, ruling party MP Esther Bulaya was quoted by local media as saying.
Tanzania has seen a huge influx of Chinese nationals in recent years, with many of them carrying out skilled and semi-skilled jobs, says BBC Tanzania reporter Tulanana Bohela.
However, workers from other African states - including neighbouring Kenya and Zambia - are likely to be most affected by the law, our reporters says.
They are employed by private firms in managerial posts, apparently because of a shortage of a skills among Tanzanians.
The Non-Citizens Employment Regulation Bill states that firms employing foreigners would have to draw up a "succession plan" to pave the way for locals to eventually take the jobs.
The government hopes the bill, still to be signed into law by President Jakaya Kikwete, will come into effect on 1 July.
Our reporter says the bill also raises questions about whether efforts to promote greater regional integration are proving effective.
Tanzania and Kenya have been involved in a dispute over whether their tour operators could pick up tourists from each other's airports, often to take them to game parks popular with Europeans.