By the middle of the 18th century Havana had more than seventy thousand inhabitants, and was the third-largest city in the Americas, ranking behind Lima and Mexico City but ahead of Boston and New York. During the 18th century Havana was the most important of the Spanish ports because it had facilities where ships could be refitted and, by 1740, it had become Spain's largest and most active shipyard and only drydock in the New World.