The Spanish entered Tenochtitlan in November 1519, about half a year after they first set foot on the mainland, not as conquerors but as the guests of Montezuma. Historians are not sure whether Cortés took the Mexica emperor captive or the other way round, but it wasn’t until the Spanish had been in the city for seven months that open conflict broke out between the two sides.
I find it strange that the conquistadors were allowed to remain in the capital city so long. To me, it seems like a breach of security to have strangers (military men) linger in your capital.