Image caption President Ma Ying-jeou addressed cheering crowds at his campaign headquarters

Taiwan's incumbent President Ma Ying-jeou has won a second term in office, promising to further improve ties with neighbouring China.

His main opponent, Tsai Ing-wen, said she took responsibility for the defeat and resigned as leader of the Democratic Progressive Party (DPP).

Mr Ma had campaigned on his record of improving ties with China.

China does not recognise Taiwan, regarding the island as a breakaway province. It wants unification.

"In the next four years, cross-strait relations will be more peaceful, with greater mutual trust and the chance of conflict will be less," Mr Ma told jubilant supporters.

"I must let Taiwan have a long-lasting environment of peace and stability."

He added: "This is not my personal victory, the victory belongs to all Taiwanese. They told us that we are on the right track."

A large number of Taiwanese remain sceptical about the downside of President Ma's policy towards China

Earlier, Ms Tsai told party workers she accepted the Taiwan people's decision and congratulated President Ma.

"We want to give our deepest apology to our supporters for our defeat," she said.

Ms Tsai's DPP favours formal independence from China, although Beijing has repeatedly threatened retaliation if Taiwan makes such a move.

With about 90% of votes counted, Taiwan's Central Election Commission said Mr Ma had won 51% against 46.3% for Ms Tsai.

A third contender, James Soong, once a senior figure in Mr Ma's party, the Kuomintang (KMT), had 2.7%.

The White House congratulated Mr Ma on his victory.

"Taiwan has again demonstrated the strength and vitality of its democratic system," a statement said.

"We are confident Taiwan will build on its many accomplishments, and we will continue to work together to advance our many common interests, including expanding trade and investment ties."

EU foreign policy chief Catherine Ashton said she hoped ties with China would continue to improve.

"I welcome the elections held in Taiwan... and reiterate the EU's support for democratic values," she said.

"The EU welcomes the improvements in cross-strait (Taiwan-China) relations over the past four years and I hope that this trend will continue, to the benefit of the people on both sides of the strait," she said.

Cross-strait relations

Taiwan has been suffering its worst economic downturn in decades and unemployment has been rising.

Image caption Many of Tsai Ing-wen's supporters wept as her defeat became clear

However, most voters still view relations with China as the most important issue.

During Mr Ma's presidency regular direct flights and shipping links have been established with China and a landmark trade deal has been signed that cuts tariffs on hundreds of Taiwanese exports to the mainland.

Beijing has 1,500 missiles aimed at the island to deter any attempt to declare independence.

The United States, which is a key ally of Taiwan, will also be watching the outcome of the vote closely.

Under the Taiwan relations act passed by the US Congress in 1979, the US is obliged to come to the defence of the island if it is attacked by any other party.

While Washington has not openly endorsed Mr Ma, observers say it is an open secret that the US prefers his approach to China.