CARACAS—China spent much of the last decade building a strategic alliance with Venezuela, a country that sits atop the world’s largest oil reserves and was led by a socialist president, the late Hugo Chávez, who admired Mao Zedong and wanted to counter U.S. influence in Latin America.

These days, confronted with a pile of unpaid bills and increasing security headaches for its citizens and companies in Venezuela, China appears to be recalculating its alliance with the nation where it has made about $60 billion in loans.