The approval of the the Anti-Infiltration Law follows accusations that China is strongly backing candidates from the main opposition Nationalist Party, including providing campaign funds and mobilizing support on social media.
President Tsai Ing-wen is favored to win a second term in the Jan. 11 vote, an outcome likely to intensify China's economic, diplomatic and military pressure over her refusal to accept its insistence that Taiwan is a part of China. China cut ties with Tsai's government shortly after her 2016 election and has sought to isolate it diplomatically while ramping-up its threat to use force to annex the self-governing island republic.
During Tuesday's debate, legislators from Tsai's majority Democratic Progressive Party cited allegations of China seeking to manipulate politics in democracies such as Australia and the countermeasures those governments took.
The law seeks to plug legal loopholes by blocking any foreign force from making illegal political donations, spreading misinformation, staging campaign events, or otherwise interfering in elections and the business of government.
Nationalist legislators argued the law would threaten anyone with dealings in China, where hundreds of thousands of Taiwanese work, live and study. Those found guilty could be sentenced to up to five years in prison and fined the equivalent of more than $333,000.
While the bill has been before the legislature for weeks, it was fast-tracked by the ruling DPP after the Nationalists nominated at-large candidates for the legislature with close ties to China's Communist Party.
Prosecutors in December also detained 10 people, including a former Nationalist Party staffer, on suspicion of falsifying documents to bring thousands of mainland Chinese to Taiwan, possibly including some who were collecting intelligence.
Concern has also been raised about Beijing's influence over Taiwanese media groups, many of which are owned by corporations with business and political connections in China. Beijing has also been actively wooing retired Taiwanese generals, many of whom are descended from mainland Chinese families allied with the Nationalists who moved to the island after the sides split amid civil war in 1949.