All Spanish below is courtesy of Babelfish. I'm gonna apologise ahead of time to any native Spanish speakers.
With a PoD before 1900s, make the Spanish colonial possessions in 2010 akin to Britain's Commonwealth. That means make all former Spanish colonial possessions develop closer ties to Spain the coming years.
Britain was able to peacefully dissolve its Empire (mostly) because of how strong it was. So, Spain would have to be a strong power herself.
First, have it decisively win the
Chincha Islands War of 1864-66, re-gaining control of Chile and Peru in the process and stamping out any hope of rebellion. This serves as a tremendous boost to national confidence at home and begins an upwards trend in Spain, a
Segunda Época Dorada de la Ascensión de la España. It also leads to the various South American nations (other than Brazil and the Guyanas) developing closer ties with Spain in order to prevent another war to regain prominance being waged against
them.
Continue with Isabel II (suddenly an extremely popular Queen) doing just about anything it takes to modernize Spain's army, navy, and industry rapidly while simultaneously avoiding fights with nations above its hit range for the moment, thereby having no Spanish Revolution in 1868. In fact, have her regin until her OTL death in 1904, giving Spain a strong, stable monarch. Additionally, have Spain make sure that its navy never threatens Britain's two-power standard - yet. Contrive to have her compare her reign to that of Queen Victoria on occasion. Make her and Victoria good friends.
Speaking of which, have Spain modernize its government earlier and with less fuss towards a true, British-style constitutuonal monarchy.
Have Isabel II engineer a war between France and Britain in the 1870s. Perhaps she convinces Britain to enter the Franco-Prussian War on Prussia's side; regardless, France needs to make a
slightly stronger showing of itself, enough to weaken Britain, if only a little. Spain intervenes as late as it can on the side of the British and Prussians, and deploys ground forces into France herself. Have those forces do well, and thereby make the various powers of Europe take Spain seriously again.
Have Spain make concessions in Cuba that allow for Cuba to be
literally treated as just another province of Spain (as many in Spain viewed Cuba), rather than a colonial holding. Shower them with gifts and love and make the Cubans
want to remain Spanish.
When the Spanish-American War starts, Spain has a modernized its fleet to be the equal of America's, and a modernized, well-equipped and well-trained army backed by a modern industrial national economy. The Spanish-American War lasts longer than America thought (there is nothing splendid nor little about this war to the Americans); say it lasts from 1898-1901, and ends with an American defeat.
Lastly, contrive a way for a Spanish monarch to become monarch of Portugal without war, and thereby gain control of all of Portugal and
her colonies.
Beginning in the early 1900s, have Spain begin enlargening its fleet now in responce to Germany's expansion of her high seas fleet. Spain, however, declares itself to be a loyal and true friend of Britain and enemy of Germany. The British and the Spanish begin working together to coordinate naval movements against Triple Alliance, should war break out. Together with Britain, the two form a sort of third power block outside the Alliance or the Entante:
La Liga de las Dos Coronas, the League of the Two Crowns, laid out with the Treaty of Lisbon in 1909. As opposed to the smi-secret treaties of the Entante or the Alliance, the provisos of the League are entirely public.
When World War I begins, Spain is a great power and a modern nation with a strong navy and army behind it, and the support of Spain from the start of 1914 leads to a more rapid German defeat in 1917 that requires no American intervention (and the Americans aren't to keen on helping out the Spanish anyway). The presence of Spain in the war also makes Italy declare war on Germany earlier due to Spanish pressure, as the Spanish wish to open an Alpine front. When the front does open, Italian and Spanish troops work together against Austria-Hungary and Germany.
Germany throughout the years leading up to the war has attempted to get SPain to become a part of Alliance (Quadruple Alliance? Doesn't have the same ring), and attempted to make the French hate the Spanish due to the Spain's involvement in the Franco-Prussian War. While France is suspicious of Spain, however, it welcomes all the help it can get against Germany.
Anyway, that's as far as I can go, but this is how I see the Spanish Empire in 1914 under the most optimal of conditions. What it might manage to gain post Versailles Treaty, who knows?