Taiwan's Nationalist party has won key mid-term elections seen as a test of the popularity of the president.
The result is seen as a vote of confidence in the KMT's chairman
The Kuomintang (KMT) party and its allies won 17 of the 23 constituencies after a campaign focused on allegations of corruption in the ruling party.
The governing Democratic Progressive Party (DPP) won six seats, prompting the chairman of the party to resign.
Analysts says the KMT victory will make it easier for the party to press on with its policy of dialogue with China.
China regards Taiwan as a breakaway province which should be reunited with the mainland.
President Chen Shui-Bian's party lagged behind the opposition throughout the short campaign as it fought allegations of corruption involving party stalwarts.
"The KMT did not beat the DPP. The DPP was defeated by itself," KMT Chairman Ma Ying-jeou said.
DPP Chairman Su Tseng-chang conceded that the "contest is over".
"It is a severe setback for the DPP... [and] warning from the people to the DPP," he told reporters. "I hereby resign to shoulder full responsibility."
The president used a tried-and-tested method to try to boost his support - China-bashing in his election addresses, says the BBC's Chris Hogg.
In the past, this kind of rhetoric has helped to motivate pro-independence supporters to back him, but it is a risky strategy, says our correspondent.
The opposition had said the election should be seen as a vote of no-confidence in President Chen.
The government and the opposition had each insisted they needed to win the most seats to show they had a mandate for their strategy to improve relations with mainland China.