 On September 27, 1821, Iturbide and the last viceroy, Juan O'Donojú signed the Treaty of Cordoba whereby Spain granted the demands.O'Donojú had been operating under instructions that had been issued months before the latest turn of events.Spain refused to formally recognize Mexico's independence and the situation became even more complicated by O'Donojú's death in October 1821.