China sees self-ruled Taiwan as a breakaway province that will eventually be under its control, and has not ruled out the use of force to take the island.
The two sides have been spying on each other since the end of the Chinese civil war in 1949.
Ten people in total were indicted for spying last year, and 8 were sentenced on Thursday. The court acquitted one while another, a retired officer, remains at large.
“They were seduced by money,” the court said.
“Their actions violated their official duties of being loyal to the country, defending the country and the people… to seriously endanger national security and the well-being of the people of Taiwan.”
Taiwan recently flagged Beijing’s growing espionage efforts, with the sentencing on Thursday being the latest in a string of cases.
Last month, a sergeant who worked at a navy training centre was indicted for allegedly photographing and leaking confidential defence data to China.
Taipei has also raised concern over the growing frequency of Chinese fighter jet flights around the island.
On Friday, Taiwan’s President William Lai said the island’s people “must unite as one” and “defend national sovereignty and safeguard democracy”.
He was speaking at an event to commemorate the 66th anniversary of China’s assault on Taiwan’s Kinmen islands.