The only countries (that were countries at the time) involved in the Spanish-American War were Spain and the United States. These two countries fought and the result of the war was a change in the control of two places that are now independent countries.
The Spanish-American war was caused in large part by a desire on the part of America to aid Cubans who were fighting for independence from Spain. Cuba was at that time a colony of Spain and was trying to gain its freedom. The same is true of the Philippines.
So, the war involved four places that are countries today, but only two of those were actually countries at the time of the fighting.