I would suggest that you research the situation, for what you have proposed is incorrect.
After Tilsit (July 1807), Napoleon and Spain planned to enter and occupy Portugal. Junot commanded the French army that entered Portugal and the Spanish were late. The French entered Portugal in November 1807 and the Spanish in December 1807.
Godoy was prime minister of Spain until the next year (1808) when he was ousted, Ferdinand attempted to supplant his father as king of Spain, and Napoleon threw them all out and replaced them with his brother Joseph.
You might want to consult Oman and Esdaile on the subject.