CHICAGO — Poor Venezuela, so far from God, so close to the People’s Republic of China. Having bid farewell to tumultuous 2016, President Nicolás Maduro’s embattled government, hit hard by low oil prices, has again bucked market expectations, muddling through without defaulting on sovereign bonds or those of the state-owned oil company PDVSA. Paying off $10 billion to Wall Street last year required many sacrifices from Venezuela: selling off or mortgaging international assets and slashing imports by nearly 50 percent for the second year running, exacerbating harrowing nationwide shortages of vital medicines and food. Without a sudden recovery of oil prices, 2017 will be even harder.

Mr. Maduro’s near-superhuman willingness to continue paying creditors long after most countries would have capitulated can seem incongruous given his trademark anticapitalist bent, but it stems from a calculation. By averting major disasters — defaults or massacres — the administration hopes that mere incremental declines, however rapid, will not trigger a backlash capable of bringing it down. The government is boiling Venezuelans like frogs in the proverbial pot while buying time to survive until the 2018 presidential election.

Such tactics alone would never suffice, however, were it not for crucial support for Chavismo — Hugo Chávez’s brand of socialism — by its Eastern benefactor, Beijing. Even as Mr. Maduro’s irresponsible policy making and growing authoritarianism have isolated Venezuela internationally and led to a humanitarian catastrophe, and even as reports expose lapses and delays in Venezuelan oil obligations to China, Beijing’s foreign ministry has remained publicly steadfast, casting new lifelines to Caracas. So what explains China’s Zen-like patience with Mr. Maduro?

China’s dalliance with Chavismo began under Mr. Maduro’s charismatic predecessor, Hugo Chávez. In 2001 Venezuela became the first Hispanic country to enter into a “strategic development partnership” with China — a relationship upgraded to “comprehensive strategic partnership” in 2014.

Since then, China has lent Venezuela some $60 billion (primarily to be repaid in oil) and established a complex joint funding operation girding more than 600 investment projects. In return, Chinese companies have received preferential access to Venezuela’s domestic market, and lucrative infrastructure and factory concessions. The flow of Chinese goods into Venezuela has grown exponentially, to $5.7 billion in 2014 from less than $100 million in 1999, not counting certain government purchases like satellites and arms shipments. Yet there’s always been more to the relationship than the affinity any energy-hungry emerging superpower might feel for a smaller nation with the world’s largest oil reserves. From the start, ideologically, the two countries were similarly committed to national sovereignty and the notion of a multipolar world order.

At a time when China was looking to expand its global role through soft power, the Venezuelan alliance offered a crucial beachhead for engaging in a region where it lacked cultural and historical ties, nestled in the backyard of the United States — its principal geopolitical rival — and where nearly half of the countries still formally recognized Taiwan.

With Venezuela sometimes acting as interlocutor, especially to smaller Central American and Caribbean recipients of its international subsidized oil programs, China fast became a major regional player. New strategic partnerships proliferated across Latin America alongside investment and banking organizations designed to exclude the United States. As a Panamanian paper put it: “Adios Uncle Sam, hello Uncle Chang.” In 2004, China achieved permanent observer status in the Organization of American States, managing, with support from Venezuela and its allies, to block Taiwan’s own bid despite United States backing and its relative regional popularity.

The relationship has paid diplomatic dividends, and today’s fraying Sino-American relationship may represent a compelling reason for further China engagement regionally. Yet Venezuela’s petro-largesse days are behind it, and any residual influence among former clients in forums like the O.A.S. or United Nations is bound to be eclipsed soon by the high cost in cash and international criticism from continuing to prop up Mr. Maduro.

In mid-2014, following the price collapse of crude oil, China signed a new cash-for-oil loan worth $4 billion, likewise agreeing to soften loan repayment terms for some $20 billion in outstanding debt. The next January, on a trip by Mr. Maduro, hat in hand, to see President Xi Jinping, a slew of new investments were announced. Since then China has continued to regularly inject much-needed liquidity into the failing government, most recently via a $2.2 billion credit line to stem PDVSA’s flagging oil production, not to mention lending several thousand vehicles ostensibly to assist in food and medicine distribution.

Some opposition leaders resent China as a regime enabler, raising the prospect of an “odious debt” scenario if Chavistas ever lose power. While Chinese loan deals are securitized, opposition legislators have claimed that any international credit agreements whose terms are not made public and approved by the National Assembly (true of most China deals) are null and void. Embryonic attempts by the Chinese government to engage with the opposition and allay such concerns have not gone far, complicated by the latter’s discordant, hydra-like nature; it remains unclear who among the opposition’s various warring chieftains would take the helm in a transition.

More than just debt is at stake. China risks finding itself denied market access or locked out of lucrative infrastructure and development projects under an aggrieved opposition government. Something similar befell China earlier this decade when, late to halt engagement with Muammar el-Qaddafi before eventually bowing to international pressure, it found itself investor non grata in post-revolutionary Libya. Indeed, a rash of December lootings, seemingly targeting Chinese business owners across the Venezuelan interior, was eerily reminiscent of the last days of the Qaddafi era, when 35,000 Chinese citizens had to be evacuated from Libya and billions in Chinese investment were lost. In continuing to support the Chavista regime indefinitely, China is drawing precisely the wrong lessons from Libya.

Recently, a freshly recapitalized Mr. Maduro crowed, “Our older sister China has not left Venezuela alone in hard times.” But it is time to do just that.

Today, only around 15 percent of Venezuelans approve of Mr. Maduro’s presidency, yet as long as he enjoys the mandate of China he can persist, prolonging Venezuelans’ agony. Changing this will require a cohesive and conciliatory message from the opposition, and sufficient foresight from China to let go of the corrupt, incompetent devil they know lest they become irredeemable to those who will follow him.

Daniel Lansberg-Rodríguez is a political columnist for the Venezuelan newspaper El Nacional and an adjunct lecturer at Northwestern University’s Kellogg School of Management.