There was perhaps no country, short of Britain, that was as relieved that the Peace of Aix was finally sorted out in early 1815 and looking ahead to the postwar era than Spain. The decade 1805-15 had been a tremendously trying one for the Iberian state; it had seen the bulk of its once-formidable fleet destroyed at Trafalgar, seen a handful of border cities including the fortresses in Barcelona occupied by French troops, undergone not one but two attempted coups by Infante Ferdinand against his grievously unpopular father Charles IV, seen both father and son go hat-in-hand to Napoleon to sort out their dispute, seen French and Spanish soldiers shoot at one another with the country teetering briefly on the edge of civil war and French occupation, and eventually Ferdinand's absconding to New Spain at British encouragement (after several failed attempts by Britain to incite revolts across the New World) to attempt to set up a pretender regime that plunged Spanish America into open war and ended with his death at the hands of the messianic mob of Father Miguel Hidalgo. Through all these political disasters, Spain's burgeoning industrial economy had been starved of the natural resources and raw materials that its vast colonial empire provided; the British blockade and interdiction of foreign shipping at sea had eliminated much, though of course not all, trade and political contact between Spain and her possessions for close to ten years, a decade of economic depression both in the metropole and in the Viceroyalties. Suffice to say, Spain's political and financial elite was eager to resume trade across the Atlantic and see a return to the good years of the early reign of Charles IV. 
The situation that faced the ailing Charles IV and his advisors, however, was one that was on paper straightforward but in practice vexing. The 18th century had seen a considerable rise in animosity between the Americas-born criollo
class, who typically made up the vast majority of the local elite and administrative bureaucracy of Spanish America, and the European-born peninsulares
who were appointed to rule in the King's name. Several revolts by the mestizo
underclasses, sometimes sympathized with by the criollos
, had erupted during the preceding century, and the Revolt of Hidalgo which had seen a hundred thousand untrained peasants overrun British and Fernandine forces and sack Mexico City was the largest and most terrifying yet. The New Spain of 1815 that Spanish administrators appointed by the Crown returned to was one of revolutionary fervor; it was not just the Fernandine Party that had been liquidated by Hidalgo's men but the reactionary Audiencia
as well, placing the criollo
party fully in control of the country. However, this papered over the severe divides within the Anti-Fernandine coalition; Hidalgo and fellow travelers such as Ignacio Allende and Jose Maria Morelos were full-throated supporters of independence outright, similar to the United States to the north, whereas others were merely supporters of the pre-Fernandine Viceroy Jose de Iturrigaray, who had advocated for more criollo
control of the New Spanish economy and bureaucracy and stood against Ferdinand's usurpation. However, Iturrigaray was in poor health, and would die by August of that year, complicating matters for those who sought more moderate reforms indigenous to New Spain.
Not helping matters, beyond the tight control Madrid held over New Spain and indeed all of Spanish America's politics, was its fiercely mercantilist system that dictated what could be built or grown, and where. It was a level of economic statism remarkable for its time and one that had left deep resentments in Spanish America, particularly among a rising, educated liberal intellectual class that while firmly monarchist and Anti-Fernandine nonetheless admired the capitalist reforms of Bonapartism. The Spanish reaction to such proposals was one of aversion; now that Spanish America was back in Madrid's control, it was time to make up for the lost fortunes denied by a decade at war with Britain. Madrid, it appeared to the informal juntas
that had governed the four Viceroyalties with communication, had learned nothing, and had resolved to listen to them even less. It was not just Hidalgo's "apostolic Jacobinism" in Mexico City that threatened revolt; criollo
monarchists such as Simon Bolivar and Jose de San Martin stood at the ready to lead struggles in South America as well.
The Spanish Empire, despite its having stood victorious at Aix alongside France, survived largely thanks to two strokes of luck. The first was that Hidalgo, who had refused for nearly all of 1815 to vacate Mexico City, died suddenly in October of that year of a typhus epidemic that spread across much of New Spain; his two fellow-travelers, Allende and Morelos, quickly fell into infighting and retreated into the mountains as bandits, allowing Spanish forces to land at Veracruz and retake Mexico City. The second was that the government of Charles IV was able to negotiate its way out of a potential war with the United States, a potential cataclysm that could have seen considerable loss of not just land but an ideological and physical support for independence movements springing forth from ambitious juntas
The United States had, for much of the 1810s, been tempted to go to war with either Britain or Spain, depending on its mood at any given moment; the most ascendant figure in American politics that decade was Henry Clay, a Kentuckian elected as Speaker of the House on his first day serving in Congress who came to lead a belligerent party known as the "war hawks" in the House of Representatives. War scares had erupted with Britain in 1812 and 1814 but been narrowly avoided, thanks largely to British caution in not wanting to create another quagmire for itself in the Western Hemisphere; as British forces had attempted to support Ferdinand across Spanish America, however, American settlers and rebels helped surreptitiously with the support of small bands of troops led by soldiers such as John Wilkinson or Andrew Jackson had pushed the boundaries of the United States unofficially southwards, illegally occupying areas such as West Florida, the Mobile District, and finally in late 1815 much of the rest of Spanish Florida, including its city of Pensacola. Though Jackson was recalled and court-martialed for his behavior in Florida, ostensibly under the cover of fighting Seminole Indians, the seizure of Florida became a cause celebre
to the war hawks, and the potential of an expansionary war with Spain was enough of an issue in the upcoming elections of 1816 that it helped make William Crawford of Georgia rather than James Monroe, the Secretary of State, the favorite to succeed President Madison.
Charles IV is, with good reason, one of Spain's most unloved kings and his mediocrity was genuine. However, the careful negotiation by his ministers with Monroe in 1816 on a sale of all of Spanish Florida, as well as a firm settling of the borders along the Sabine River, Red River, Arkansas River and 42nd parallel north, an official denotation of the boundaries of New Spain and the Unorganized Territories of the United States after the Louisiana Purchase; this "Transcontinental Treaty," as it came to be known, was regarded as a triumph of diplomacy by Monroe and was later used as the basis for American claims to the Oregon Country. Spain, meanwhile, avoided a costly war over a corner of its empire it cared little for and reinvigorated it with financial resources it could turn around and use to reinforce its position across the rest of Spanish America with economic investments, new garrisons and hiring bureaucrats; it was quite possibly the only real success of international relations in the whole of "Cuckold Charles'" otherwise floundering reign.
Back in Spain, selling off a chunk of the Empire was not as popular, even if in hindsight it was a pragmatic victory. The King's detractors organized themselves in what came to be known as the Apostolic Party, a group of rigid Catholics who eagerly intrigued in Madrid to reinvigorate Spanish absolutism upon the King's death; they were encouraged in this effort by the widespread knowledge that the heir, Infante Carlos, was a deeply pious man whose political ideas were vaguely formed beyond his firm belief in divine right, and who concurrently with this lack of imagination or even ambition had shown little talent for statesmanship. For Spanish moderates and liberals, then, it became a game to contest against this "Carlist" faction, to persuade the heir of their ideas (often through his smarter, more moderate younger brother Francisco as an intermediary - the brothers were personally close and Carlos instinctively trusted Francisco's advice) to reform Spain where it was needed without triggering a response from the apostolicos
. This contest played out behind the scenes for many years, helping temper irritation in Madrid at the sale of Florida and the continuing tensions in Spanish America that occassionally bubbled over into small revolts; but in January of 1819, Charles IV died three weeks after his wife, meaning that Infante Carlos was now Charles V of Spain, and the quiet struggle to appease Spanish American criollo
reformists and moderates at home would now become a genuine political battle with the reactionary Catholic holding formal power...
 Spain is leagues ahead of where it was IOTL's 1815 without a Peninsular War; that does not mean that its myriad problems have been entirely solved, just that it has much less severe problems.