How would it matter if people support war when Spain was not the aggressor? They supported it as it was a defensive war. In these times it was obvious to fight.
I read a Polish book, some years ago, later on the evening (I live in CET zone) I will provide this as a source if someone is interested, but the main idea was that Spanish knew they were about to loose. EDIT: I added this below as UPDATE 2
It was just a matter of honour for them. I think, however, they did not expect it would end so soon and in such decisive way.
The reasons were obvious: long distance from Spain both to Cuba/Puerto Rico and Philippines, much worse navy and fighting (on Cuba) in fact on enemy terrain. After losing the core of her navy, Spain was not able to continue fightings.
The Wikipedia states
The loss of Cuba caused a national trauma because of the affinity of peninsular Spaniards with Cuba, which was seen as another province of Spain rather than as a colony (...) The Spanish soldier Julio Cervera Baviera, who served in the Puerto Rican Campaign, published a pamphlet in which he blamed the natives of that colony for its occupation by the Americans, saying: "I have never seen such a servile, ungrateful country [i.e., Puerto Rico].... In twenty-four hours, the people of Puerto Rico went from being fervently Spanish to enthusiastically American.... They humiliated themselves, giving in to the invader as the slave bows to the powerful lord."
You might want to read it further, as it is shown, that the war led eventually to economic success for Spain. Please also read about Generation of '98.
As Felix Goldberg noticed in his comment below the post, the problem seems to be more complicated than I expected at first.
It is clear that US wanted to control Cuba and did some provocations (like USS Maine), but it was Spain who declared war. In the Library of Congress there is a timeline of events and shortly the Cuban insurrection (but this could be some disorder) began, than Philippine revolution started.
It seems that Spain asked European powers for assistance, eg. on 1896-08-09
Great Britain foils Spain's attempt to obtain European support for Spanish policies in Cuba.
 William Warren Kimball, U.S. Naval Academy graduate and intelligence officer, completed a strategic study of the implications of war with Spain. His plan called for an operation to free Cuba through naval action, which included blockade, attacks on Manila, and attacks on the Spanish Mediterranean coast.
(The last part proves Felix's note about not losing core of her fleet but core of expeditionary forces. Spain could have had some knowledge and the threat of attack in Europe could be serious).
This suggests that USA made aggressive policy against Spain, while Spain was attempting to find (after military suppression, however) peace solution, for example on 1898-01-01
Spain grants limited autonomy to Cuba. (it was before USS Maine).
The United States Government issued an ultimatum to the Spanish Government to terminate its presence in Cuba. Spain did not accept the ultimatum in its reply of April 1, 1898.
It was obvious that Spain could have not accepted it. It was a common practice, and such ultimatum was a direct reason of the WW1. This was also backed by newspaper propaganda. What I may suppose, such ultimatum was not welcomed in Spain and moreover, on 1898-04-13
The U.S. Congress agreed to President McKinley's request for intervention in Cuba, but without recognition of the Cuban Government.
This is obviously aggressive policy against interior policy of Spain. So on the same day or before April 19th
The Spanish government declared that the sovereignity of Spain was jeopardized by U.S. policy and prepared a special budget for war expenses.
This eventually led to declaration of war by Spain.
The book I was referring to was "Wojna amerykańsko-hiszpańska na morzu 1898" by Paweł Olender.
Some citations (translated by myself):
Z biegiem czasu w obozie hiszpańskim zaczęły ujawniać się tendencje pojednawcze. W paździeniku 1897 r. został odwołany z Kuby gen. Weyler, zwolennik bezpardonowej walki z powstańcami, a w niecały miesiąc później rząd hiszpański nadał Kubie autonomię.
Over the time, the Spanish camp was beginning to show trends conciliation. On October 1897, General Weyler, a relentless supporter of the fight against insurgents, was dismissed from Cuba and in less than a month later, the Spanish government gave autonomy to Cuba.
In the Cuba herself there were also anti-American riots:
(...) w większych miastach Kuby, szczególnie tam, gdzie spory procent stanowili Hiszpanie, dochodziło raz po raz do wystąpień antyamerykańskich. Między innymi, 15 stycznia oraz w przeciągu kilkunastu następnych dni, doszło do gwałtownych demonstracji zorganizowanych przez nacjonalistów hiszpańskich w Hawanie.
(...) in the larger cities of Cuba, especially where large percent of people were Hispanic, there were occurring from time to time anti-American demonstrations. Among other things, on January 15th, and within the next few days, there were violent demonstrations organized by Spanish nationalists in Havana.
Dowództwo nad ostatnim zespołem [floty] powierzono (...) kontradm. Cerverze. Był to bez wątpienia oficer zdolny, energiczny, odważny i zdyscyplinowany, (...) jednak wybranie go na to stanowisko było o tyle błędne, że nie wierzył on zbytnio w możliwość zwycięstwa nad Stanami Zjednoczonymi. (...) Na usprawiedliwienie tego faktu można jedynie dodać, że podobnie myślała wówczas większość oficerów liniowych marynarki hiszpańskiej i władzom trudno było znaleźć kogoś odpowiedniejszego na to stanowisko.
The command of the last unit [of the fleet] was given to (...)Rear-admiral Cervera. It was undoubtedly a capable officer, energetic, courageous and disciplined, (...), but nominating him was wrong as he did not believe too much in the possibility of victory over the United States. (...) As the justification for this one can only add that, just thought the majority of line officers of the Spanish Navy and it was difficult for authorities to find someone more suitable for the position.
(later a memo of Cervera taken from S.G. Nunez The Spanish-American War. Blocades and Coast Defence, Washington 1899, pp. 33-34)
The book says nothing about common people in Spain. It seems, that as military officers were against the war, they were forced to act by politicians.