Sanchez, who is on his fourth visit to China in four years, spoke at Tsinghua University in Beijing.
His visit comes as many Western governments seek to maintain engagement with Beijing despite lingering security and trade tensions. It follows visits to China by the prime ministers of Britain, Ireland, Canada and Finland earlier this year.
Spain has been one of the most vocal European advocates of expanding trade and treating China as a strategic ally rather than an economic and geopolitical rival.
Sanchez said China could do more in terms of combating climate change, promoting global health, controlling the development of responsible artificial intelligence, as well as nuclear weapons.
"For example, demanding, as it does, that international law be respected and that conflicts in Lebanon, Iran, Gaza and the West Bank, and Ukraine cease," Sanchez said, citing "Asahi„.
The Spaniard added:
"Europe will also have to redouble its efforts, especially now that the United States has decided to withdraw from many of those fronts."