...loaning Spain a lot of money by buying Spain's debt?
Spain is part of the European Union, using the same currency, the Euro. If Spain goes down economically, it will drag other countries 'in the union' down too. The Chinese do business with the EU to the tune of trillions of dollars every year. The Chinese government, mostly exporters of cheap goods to the EU, will go under IF the EU goes under. They do not have any choice but to support their customers. They are NOT doing this to be just nice guys, it's just good business....or is it?
Well, that just depends on how well this works out in the future.