Taiwan should abandon its "hallucinations" about pushing for independence as any moves towards it would be a "poison", Chinese state-run media said after a landslide victory for the island's independence-leaning opposition.

The comment comes after Taiwan elected Tsai Ing-wen as its first female president, handing her pro-independence party its first majority in the national legislature and rejecting the China-friendly party that has led the self-governing island for eight years.

In a statement issued after Tsai's win, the Chinese Cabinet's body for handling Taiwan affairs reaffirmed its opposition to Taiwan independence, but said it would work to maintain peace and stability between the two sides of the Taiwan Strait.

Economy key issue as Taiwan heads to polls

"Our will is as strong as a rock, our attitude unswerving on the principal matter of safeguarding national sovereignty and territorial integrity," the Taiwan Affairs Office said.

Voters concerned that Taiwan's economy is under threat from China and broadly opposed to Beijing's demands for political unification resoundingly chose Tsai over the Nationalists' Eric Chu, a late replacement for his party's original candidate who was seen as alienating voters.

Tsai said her victory was a further show of Taiwan's ingrained democracy and its people wish for a government "steadfast in protecting this nation's sovereignty." She too pledged to maintain the status quo with China. She said both sides have a responsibility to find a mutually acceptable means of interacting, while adding that Taiwan's international space must be respected.

She said she would correct past policy mistakes, but warned that "the challenges that Taiwan faces will not disappear in one day".

Chu resigned from his party's leadership to take responsibility for the massive loss. In the final tally, Tsai won more than 56 percent of votes, while Chu had 31 percent and a third-party candidate trailing in the distance. Outgoing President Ma Ying-jeou is constitutionally barred from another term.

Making Tsai's task easier, her Democratic Progressive Party won 68 seats in the 113-member national legislature that has been traditionally dominated by the Nationalists, who took 36 seats, with the rest won by independents and smaller parties. Illustrating the extent of their defeat, the Nationalists had won 64 seats four years ago.

The new legislature convenes next month, while Tsai is set to be inaugurated in May.

Her win will introduce new uncertainty in the complicated relationship between Taiwan and mainland China, which claims the island as its own territory and threatens to use force if it declares formal independence.

China's official Xinhua news agency also warned any moves towards independence.

"If there is no peace and stability in the Taiwan Strait, Taiwan's new authority will find the sufferings of the people it wishes to resolve on the economy, livelihood and its youth will be as useless as looking for fish in a tree," it said.

Tsai has refused to endorse the principle that Taiwan and China are parts of a single nation to be unified eventually. Beijing has made that its baseline for continuing negotiations that have produced a series of pacts on trade, transport and exchanges.

Reporter's Notebook: China's shadow looms over crucial Taiwan election

Observers say China is likely to adopt a wait-and-see approach, but might use diplomatic and economic pressure if Tsai is seen as straying too far from its unification agenda.

In its statement, Beijing's Taiwan Affairs Office reiterated its insistence on the "one China principle".

"We are willing to strengthen contact with any political party or social group that agrees that the two sides of the Strait belong to one China," the office said.

Taiwan was a Japanese colony from 1895 to 1945, and split again from China amid civil war in 1949.