Answer
Godoy made peace with France at the behest of Napoleon Bonaparte. Napoleon, having ascended to power through the French Revolution, sought to consolidate his rule and expand French influence in Europe. Godoy, as the de facto ruler of Spain, was eager to maintain good relations with France, recognizing the potential benefits of an alliance with the rising European power.