Hmm, a Spanish-American War in the 1870s where Spain wins, -
In this case, Joan Prim would probably have his star on the rise, even under Amadeo and the (OTL First) Spanish Republic. The better idea, though, is to have Prim take his experience as Governor of Puerto Rico to heart and advocate for both reforms and increased autonomy for both Cuba and Puerto Rico within Spain - essentially what Madrid ultimately tried to set up during the 1890s until the Americans intervened IOTL. While this would be controversial among the Spanish political class, in this case it would be the right thing to do to take off some of the steam in the Cuban independence movement. (Of course, there would be Cubans not happy with the arrangement, so there would still be room for a *Ten Years' War > *Spanish-American War, but in the main most Cubans would be happy to finally get
juridical personality as a self-governing region.)
That, however, is just one building block for the development of a new Spanish constitutional order, as the
Glorious Revolution leads directly to the establishment of a Spanish Republic (so no Amadeo) organized along the lines of the United States and the new Comtean-positivist order, as a semi-presidential federal republic (the world's first, at this time) comprising Spain proper, Ceuta, Melilla, Cuba, and Puerto Rico - with the autonomy arrangements for Cuba and Puerto Rico serving as a precedent for the forming of Spain's new first-level administrative divisions. However, because of the presence of tradition and a need to bring conservatives on side, the government would be one that balances tradition and modernity - much like, IOTL, the bad old days of PRI rule in Mexico, but this time within a genuine multi-party democracy that is more genuine than the
turno IOTL. A war where Spain wins would give additional credibility and legitimacy to the Republic. As Spain industrializes (and probably spreads out the benefits of industrialization more, so Cuba would be affected here), it could attract additional foreign investment, especially from the other major powers at the time - so Spain would be very much a relatively neutral power in Europe (not like Switzerland, but probably close enough). The United States is already heavily investing in Cuba around this period; France and Germany could additionally benefit from investing in Spain, since it has resources neither of those countries have even among their colonies. In this manner, not only would Spain be industrializing at a similar as Germany and Japan, but would also be in concert with the positivist experiments in Mexico and Brazil.