BEIJING—Chinese President Xi Jinping installed a trusted ally as deputy head of state, keeping an experienced troubleshooter by his side to help handle Beijing’s rocky ties with Washington.

China’s legislature Saturday appointed as vice president Wang Qishan, who ran Mr. Xi’s relentless anticorruption campaign before reaching a customary retirement age and stepping down from the Communist Party leadership last fall.