BEIJING — Panamanian President Juan Carlos Varela was making his first state visit to Beijing on Friday after breaking off relations with Taiwan and establishing formal ties with China five months ago.

Varela was to meet with Chinese President Xi Jinping at the Great Hall of the People after officially opening the new Panamanian Embassy in Beijing on Thursday.

Panama’s break with Taiwan left the self-governing democracy with just 20 diplomatic allies, mainly small developing nations in Central America, the Caribbean, the South Pacific and Africa.

China claims the island as its own territory and has campaigned relentlessly to isolate it globally.

Panama said its decision to switch ties was economically motivated, although it also endorsed Beijing’s “one-China principle” stating that Taiwan is Chinese territory. With China rapidly expanding its economic footprint abroad, Varela has said he hopes the new relationship will prove an economic boon to his Central American nation.

China is already the second-most frequent user of the Panama Canal after the United States, and a Chinese consortium operates the ports at both ends of the passageway.

Beijing renewed a campaign to diminish Taiwan’s global standing last year after cutting ties with the government of independence-leaning President Tsai Ing-wen, who has refused to endorse China’s insistence that Taiwan is part of China.

Along with plucking away Panama and two of Taiwan’s African allies, Beijing has barred Taiwan’s representatives from attending the World Health Assembly and other gatherings to which they formerly had access.