China views Pakistan as a powerful regional ally with whom it shares important economic and security objectives.

The two have had warm relations virtually from Pakistan’s independence. Pakistan was among the first to sever ties with the Republic of China and establish permanent diplomatic relations with the PRC, something for which Beijing is especially grateful.
Why is China empowering Pakistan?
Why is China empowering Pakistan? 

More important, the two are united in their distrust of India’s strategic intentions and growing power, as well as US efforts to assert political dominance in South Asia. In this context, China is close to supplanting the US as the major supplier to Pakistan of military equipment. She strongly backs Pakistan’s position on Kashmir and shares concern about Afghanistan and the continuing risk of political violence emanating from that unstable neighbour.
Furthermore, the PRC values sound relations with the region’s major Muslim power, as both a gateway to expanding ties with other Muslim states and a positive influence on China’s restive Muslim-dominated western provinces.
Beijing also casts covetous eyes on Pakistan’s fine saltwater ports as a strategic option for the transhipment of oil and other natural resources that would shorten delivery time and reduce the risk of piracy presented by the traditional route via the South China Sea and the Malaccan Straits. To this end she is investing heavily in Pakistan’s transportation and communication infrastructure development.
In sum, the two countries see eye to eye on an array of political and economic issues that make them natural partners as they both seek to enhance their regional influence and protect their strategic interests