The party of Taiwan's president has won the most seats in an assembly to change the constitution, a move China fears may lead to the island's independence.
Officials offered incentives for people to vote
Chen Shui-bian's Democratic Progressive Party (DPP) won 42.5% of the vote - the opposition Nationalist Party 38.9%, election officials announced.
Mr Chen will see the result as a vote of confidence in his policy towards China, says the BBC's Chris Hogg.
Beijing had tried to build support for anti-independence parties.
It invited opposition leaders to Beijing for historic talks in the run-up to the poll.
After the result, Vice-President Annette Lu congratulated the party and criticised China.
"I would like to thank the Chinese Communist Party, because each time there is pressure from China, the people show that democracy is what people embrace here in Taiwan," she said.
"One billion three hundred million Chinese friends on the mainland and (Chinese) President Hu Jintao, you have heard the voice of Taiwan's people, Taiwan belongs to its 23 million people."
Taiwan's government says it wants to change the constitution to improve the way the island is run.
The most controversial plan would be to subject any future change to the constitution to a national referendum.
The amendments include:
- Halving the number of lawmakers in the island's parliament
- Extending their term of office by a year
- Changing the way they are elected.
Beijing has been courting Taiwan's opposition leaders
Both the governing DPP and the opposition nationalists - or Kuomintang - support the proposed changes to the constitution.
And this ballot came to be seen instead by many as a referendum on wider issues, most importantly, the best way to move forward relations with China, says our correspondent.
The result will be a boost for President Chen's robust approach, he says.
It is a setback for the nationalist leader, Lien Chen, who made a historic trip to Beijing in the run up to the polls to meet China's President Hu Jintao, our Taipei correspondent says.
Voters in the election were for the first time asked to vote for parties rather than individuals in each constituency.
The parties put up lists of candidates, declaring whether or not they support the constitutional changes.
Those who gain a seat are then obliged to vote in the assembly according to the position their party set out on the ballot paper.
Fewer seats should mean a better choice of candidate, President Chen says.
Our correspondent in Taipei says the legislative chamber has in the past been better known for its punch-ups than the standard of debate there.
Voters were offered raffle tickets with prizes ranging from electronic gadgets to a million Taiwanese dollars ($32,000) in cash, as an incentive to turn up.
In the event, only about 23% turned out - a new record low.
A national assembly will now be formed based on the proportion of votes cast for each party.
It will begin the ratification of a number of constitutional amendments at the end of this month.