China regards Taiwan as its breakaway province and does not have diplomatic relations with any countries recognizing Taiwanese sovereignty.
"The Costa Rican government recognizes that there is only one China in the world and the government of the People's Republic of China is the sole legitimate government representing the whole China. Taiwan is an inalienable part of the Chinese territory," the agency quoted the governments as saying in a joint communique signed June 1.
Costa Rica established relations with Taiwan in 1949, when millions fled to the island with the advent of the Communist regime and civil war in China. The Latin American state did not sever ties with Taiwan even in the early 1970s, when China replaced Taiwan in the United Nations and was recognized by the majority of states.
China and Taiwan, which have separate governments, compete for diplomatic recognition. Both fast-growing economies use economic levers offering privileges or aid to countries for diplomacy.
Taiwan fears Costa Rica's move could prompt other Latin American nations, Nicaragua and Panama, to switch sides, experts say. Taiwan has diplomatic relations with only 24 countries mainly in the Pacific, South America and Africa.