In answer to both your questions, yes. During that time Spain ping-ponged between very different governments, who each had a different attitude to the question of empire.
In the last years of the 19th century and into the 20th, Spain's process of political and economic modernisation was proving to be a very difficult one, and as a consequence, Spain was undeniably lagging behind the rest of western Europe. Spanish politicians and intellectuals were only too aware of this, but they only reached any sort of agreement on the answer in 1898, with Spain's disastrous defeat in the Spanish-American War. For Spaniards, this represented the humiliation of the nation that had once ruled the waves by an upstart nation barely a century old. An Aragonese politician called Joaquín Costa proposed the theory that it was the modernisation and the loss of Spain's conservative values that had cost it its empire and its naval dominance. This theory gained significant popularity, and grew into a philosophy known as 'Regenerationism'.
Regenerationism was a broad church, but the loudest voices were those who, like Costa himself, advocated an 'Iron Surgeon' - a dictatorial leader who would operate on Spain's diseased body politic and implement harsh, rapid social, economic and political reforms to bring back the confessional state (i.e. the inseparability of the Catholic Church and the Spanish State), the suppression of regional nationalisms (especially in Catalonia and the Basque Country), and a new politics that would end the corruption that was rampant in Spain (especially in the form of caciquismo, whereby local landowners and bosses could influence elections and the legislative process). (an excellent article about all this is Sebastian Balfour's 'The Loss of Empire
In 1921, the Spanish army suffered another devastating defeat, this time by Moroccan combatants looking to form a new Republic of the Rif, independent from Spanish Morocco. Many Spaniards blamed King Alfonso XIII for the defeat, and this greatly aided the build-up of Republican sentiments that would eventually lead to the creation of the Second Spanish Republic in 1936. (also Balfour) In the meantime, however, the Iron Surgeon had arrived. In 1923 General Miguel Primo de Rivera seized power, and in his 'Barcelona Manifesto' outlined his plans for Spain, and justification for seizing power based on 'Regenerationist' thought and on the long precedent of the Spanish military staging peaceful coups known as pronunciamientos - 'pronouncements. We can see, therefore, that the imperial question was one that had a great deal of political weight in Spain in the first quarter of the 20th century.
Eventually, though, it became pretty clear that Primo de Rivera was failing to end the corruption of the hated caciques, or to retrieve any semblance of empire, and he was eventually ousted in 1931. (see Javier Moreno Lúzon, Modernizing the Nation, especially chapter 4. 'Dictatorship and Final Act') Alfonso XIII had made the mistake of supporting the dictator, so he was also swept away and the Second Spanish Republic was proclaimed on 14 April 1931, along the lines of a modern, pluralist liberal democracy. (see Shlomo Ben-Ami, 'The Crisis of the Dynastic Elite in the Transition from Monarchy to Republic, 1929-1931' in Frances Lannon and Paul Preston (eds.), Elites and Power in Twentieth-Century Spain) The Spanish right was still very strong, so the imperial question certainly didn't go away, but at least now its importance could be questioned in the Cortes (parliament) and in elections.
(sorry but I'll probably have to skip over a lot of very interesting stuff about the successive governments of the Republic because I don't have evidence specifically about their attitudes towards empire, but we can probably assume that the right-wing CEDA government that came to power in 1933, for example, used similar imperialist rhetoric to the rest of the right.)
In July 1936, though, everything changed when the fire nation attacked political tensions and violence that had been bubbling throughout the Republic's life spilled over into all-out civil war, when a group of right-wing army generals launched another conservative coup against the recently-elected (elected in February 1936) Popular Front government and failed to seize power quickly and cleanly. As the swirling maelstrom of violence coalesced into recognisable battle-lines, it became clear that there were now two Spains: the Republic, and what became known as Nationalist Spain.
The Nationalist generals had numerous propaganda justifications for their coup, and propaganda narratives to explain their war aims and social programme for Spain once the war was over, and one of the big aspects of these narratives were that a Nationalist victory would enable that same imperial regeneration promised by the right-wing for the last four decades. Sources like the Nationalist poster ''Spain Was, Is, and Will Be Immortal' tell us something of the Nationalist attitudes to empire as a 'Golden Age' that all good Nationalist soldiers should have in their minds at all times. (Miriam Basilio's article 'Genealogies for a New State: Painting and Propaganda in Franco's Spain, 1936-40' has a good analysis of this poster. Another good article for the Nationalists' construction of propaganda narratives, including that of the return to imperial greatness, is Mary Vincent, 'The Martyrs and the Saints: Masculinity and the Construction of the Francoist Crusade').
Hope some of that helps.
edit: just found this fine quote regarding Nationalist propagandic uses of Spain's imperial past: ‘The poetic arsenal of the Right also included constant allusions to the Reconquest, the Crusades, the conquistadores, and the Escorial. To bolster further the righteousness of their position, the Nationalists described themselves as direct heirs to the Catholic kings and enlisted great figures of the past to their cause: Velázquez, Cortés, Pizarro, Santa Teresa, and San Juan de la Cruz. Indeed, such names, shouted in an intoxicating manner, served for a time as a substitute for ideology.’ -Alun Kenwood, 'Art, Propaganda, Commitment: Hispanic Literature and the War' in Alun Kenwood (ed.), The Spanish Civil War: A Cultural and Historical Reader.
I'd only add to /u/counterc 's comments that in the 19th century there were several attempts at reconquest.
The first major attempt at reconquest was in 1821 when an army was gathered in southern Spain for that purpose, but which later decided on its own to not leave for the Americas but instead cause a coup d'etát in Spain (the so called 'Liberal Three Years' or Trienio Liberal).
Between then and the 1830's Spain's focus was on not losing what few possessions remained, especially Cuba, which had suddenly become a major source of revenue (through a booming plantation economy) despite centuries of being economically dependent on New Spain (now Mexico).
The next several decades in Spain were ones of chaos. Liberal vs Conservative civil wars, rival branches of the Bourbon vying for the throne, etc. Nonetheless, in the early 1860's Spain briefly recaptured the Dominican Republic. The territory was soon lost, however.
The impact of its capture is important though. Spain's breaking of the status quo understanding of Spanish American independence caused renewed interest in these same countries aiding Cuba and Puerto Rico in becoming independent. This frightened Spain to no end, especially given that it would soon lose control of the situation in Cuba, leading to a decade long independence war which would exhaust it economically and tie it down militarily.
Fortunately for Spain, the Spanish American countries of the continent were too busy with their own civil wars, crushing debt and other pressing issues to ever turn their desire to help Cuba into anything concrete.
After the first independence war in Cuba failed, Madrid realized that the best it could do was to try to hold on to existing possessions as best it could. (EDIT: They also really didn't want to anger Spanish America any further, just in case the continentals got their shit together) Nonetheless independence wars would plague its possessions, on and off, right up until the moment that the US army occupied them (in the Philippines they started right back up after realizing that the Americans weren't leaving anytime soon).
By this point the world had already been divided into 'great spheres of influence'. No territory remained unclaimed by another power, or free from the protection of one, by the 20th century. The Spanish were therefore limited to what influence was permitted that they retain, in part to maintain balance between the other colonial powers.
I'm unable to provide a verified source at the moment due to using my phone, but I know from previous study that there is an interesting discussion about the loss of empire on the 'generation of 1898' this was first discussed in La generación de 1898 by José Martínez Ruiz in 1913 and it has been debated as to whether the loss of the Philippines & Porto Rico at the end of the 19th century had a lasting effect on the consciousness of imperial Spain leading up to the Spanish civil war. An interesting literary example of this woul be Arturo Barea's La Forja de un Rebelde trilogy. Notable is the second book of the trilogy which discusses the Rif War and Spanish colonial activities in North Africa during the 1920s. Sorry again for the lack of linked sources. I can always have a rummage around for a reading list if you're still interested OP.
During the reign of Queen Isabella, during the mid nineteenth century, Spain did increase its spending on its navy. In 1859, it had the fourth largest fleet in the world. The Union navy of the United States had an explosive growth in size during the early 1860s, but it was distracted by its war against the Confederate States of America. Spain took advantage of this distraction and began to hassle the former Spanish colonies on the west coast of South America. Spain fought a war against Peru, known as the Chincha island war in 1864-1866. Spain occupied the Chincha islands, which had deep deposits of guano, a very valuable resource, in an era before modern chemical fertilizers were produced. Peru was able to enlist help from Chile, Bolivia and Ecuador and defeat this Spanish attempt to reestablish colonies off the west coast of South America.
The Chilean Navy has a web site that provides details of this small war. It is written in Spanish and unusual in the sense that you have to scroll down to the bottom of the page to read about the start of the war, the top of the page details the battles at the end of the war. It was a naval war. Spain did not send an army to try and reconquer Chile, Peru, Bolivia or Ecuador.
http://www.armada.cl/armada/site/tax/port/all/taxport_2_3_133_1.html