Napoleon's critical error was to invade Spain so that he could punish Portugal for continuing to trade with Britain. It was Napoleon's hatred of Britain and his arrogance that sowed the seeds of his downfall, that combined with his tardiness in changing the tactics of the French armed forces. He attempted to impoverish Britain by cutting it off from it's colonies, The plan backfired when the superior British navy cut France off from it's colonies and reduced the French army to land based supplies which in turn contributed to the subsequent French defeat in the peninsular war. It's a fascinating period of history.