Image copyright China News Service Image caption China has intensified its economic investment into the Central American country in recent years
Panama has cut long-standing diplomatic ties with Taiwan and established relations with China, in a diplomatic coup for Beijing.
The Panamanian government said it recognised there was "only one China" and considered Taiwan part of it.
Taiwan expressed "anger and regret", and accused Panama of "bullying".
China regards Taiwan as a breakaway province. A few countries maintain ties with Taipei instead of Beijing, and Panama is the latest to switch sides.
In December last year, the African island nation of Sao Tome and Principe made a similar move. Now only 20 countries have diplomatic relations with Taiwan.
In recent years China has intensified its economic investment into the Central American country - home of the economically vital Panama Canal.
Taiwan's foreign ministry said in a statement that it expressed "anger and regret" over what it called a "very unfriendly" diplomatic turn by Panama that "yielded to economic interests by the Beijing authorities".
It accused Panama of "bullying" Taiwan while "ignoring the many years of friendship" between the two countries, and added it would "not compete with the Beijing authorities for money diplomacy".
It was as recently as June last year that Taiwan's leader Tsai Ing-wen visited Panama, on her first overseas trip as president.
Image copyright AFP/Getty Images Image caption Ms Tsai (left) met president Juan Carlos Varela (right) on her visit to Panama last year
Following Panama's announcement, China's state media published photos of the two countries' foreign ministers in Beijing signing a document establishing diplomatic relations and toasting with champagne.
Panamanian President Juan Carlos Varela said in a televised address that he was "convinced that this is the correct path for our country".
China's foreign ministry also released a statement (in Chinese) saying that "the Chinese government and its people highly appreciate and warmly welcome" the move by Panama.
The United Nations in 1971 switched diplomatic recognition to Beijing's People's Republic of China (PRC) and most countries have since followed that lead in order not to antagonise the resurging economic giant.
Many of Taipei's remaining backers are small island states or in Central and South America - regions that in the past had limited economic ties with China.
'Political isolation' - by Cindy Sui, BBC News, Taipei
This is perhaps the biggest blow Taiwan has suffered since relations with Beijing began deteriorating last year.
Beijing's luring away of Panama is due to political rather than economic reasons. China could have continued investing in Panama without official ties.
Beijing has lost patience with Tsai Ing-wen, suspecting her of trying to wean Taiwan away from the mainland, economically and politically, with the aim of independence.
So China has raised the pressure, cutting off dialogue with Ms Tsai's administration and reducing the number of Chinese tourists visiting Taiwan. It's also keeping Taiwan out of international and regional groups.
Beijing's moves may strengthen anti-unification sentiment in Taiwan, but it sees not losing Taiwan as a crucial part of its national identity and seems willing to take this risk.
If the current stalemate continues, Taiwan risks further economic and political isolation.
Image copyright AFP Image caption The Panama Canal is vital for global trade
Given China's rapid growth as an economic and political superpower, it has been increasingly easy for Beijing to sway countries to its side.
In the case of Sao Tome and Principe, Taiwan's foreign ministry condemned the move, alleging the island nation had demanded a huge amount of financial support.
Panama did not give any reason for changing its diplomatic allegiance but there has been growing economic co-operation with China in recent years.
Chinese companies are developing ports in Panama, and Chinese state firms are said to have expressed interest in developing the land around the Panama Canal once the country opens a tender for it later this year.
The Panama Canal is a vital shipping route. As China expands its global trade ambitions with its One Belt One Road infrastructure-building initiative, access to the eastern coasts of both South America and the US is expected to be of growing importance for Beijing.
The switch by Panama leaves Taiwan with a handful of nations with whom it has diplomatic ties. They are:
Em junho de 2017, o Panamá cortou os laços diplomáticos que tinha com Taiwan de longa data e estabeleceu relações diplomáticas com a República Popular da China.

O governo panamenho reconheceu que havia "apenas uma China" e disse que Taiwan faz parte dela. Depois de ter feito isso, Taiwan expressou "raiva e arrependimento", e acusou o Panamá de "bullying".

A China tem divergências de mais de seis décadas quanto à soberania de Taiwan. A China considera Taiwan como uma província chinesa, enquanto Taiwan se autoproclama um Estado autônomo.

Alguns países mantém relações diplomáticas com Taiwan em vez da República Popular da China. Apesar disso, apenas 20 Estados-membros da ONU e a Santa Sé mantém relações diplomáticas com a República da China.

Nos últimos anos, a República Popular da China intensificou seu investimento econômico no País da América Central, uma economia vital para o pais.