I understand that travel from Spain to the American territories was tightly controlled, was movement between the Viceroyalties similarly controlled?
My initial reaction was to say that it was quite easy, but I'll check that a little because by today's standard it is obviously not easy nor common. There wasn’t really a middle class per se, or at least historians haven’t used that phrase much. Older generations of scholarship described colonial society more along patrician/plebeian terms, but scholars in the last few decades avoid ascribing class from the modern world to people in the past who had no such concept, at least in the English-language scholarship, this is the trend.
But men did move in the colonial period with relative ease, especially people with some means. Though most would stay relatively close to home, they occasionally pursued opportunities or tried their hand at some other career in distant locations. It was more common to leave the region, than to leave the viceroyalty completely. To my knowledge, no license was required to go somewhere else. If such a thing existed, I suspect that I would have come across it in the archives or in my secondary source reading, or perhaps it was not enforced.
The key to moving was that you had to have some sort of connection in another place or were part of some sort of community. Often, these moves were related to the standard course of life of a person or employment. Boys generally lived at home until they were about 10 or 12 or an early teen. Then they would generally leave home to learn a trade. Most likely, this would have been some sort of career common in the area that they lived in or related to property that their family owned. If the young man was of some means, he might also learn to read and write at some point in his childhood, either formally in a school or informally. He might even be able to get a more advanced education. Or he may have been apprenticed in with a family friend, family member, or another male figure who took the boy under his wing. Males might also get a job in a more transient career like a soldier, a muleteer, a clergyman, a missionary, or a sailor, which would take them far from home and lead to opportunities to leave the viceroyalty.
As their careers developed, they would develop wider connections related to their businesses, their families, and their friendships. Or they might switch careers in pursuit of something new. For example, a merchant family in Veracruz might have many business connections in Havana, Cartagena, or Portobelo. A young man might move to be closer to these connections in Portobelo, get involved with a new business, build a new circle of friends, family, or business contacts, and then move again from Portobelo to Lima, following other opportunities that he learned about while in Panama. One rarely just up and moved to Peru or Chile out of the blue. They moved because they knew someone who knew someone. Or their job took them to one place, which offered new opportunities in another. Trust mattered, as did the flow of information about current conditions and opportunities in a distant place. So our new resident in Peru would now write to his friends and family in Portobelo, Havana, and Veracruz, giving information about opportunities there, which might attract new travelers.
Just a couple of examples that pop to mind in books within reach. One is Catalina de Erauso, a fascinating historical figure who does not receive enough attention on AskHistorians. Catalina was born a female in 1585 in the Basque Country, located in northern Spain. (Lacking adequate pronouns in English for this person, I’m going to use the third person.) Catalina was committed to a convent by their parents as a child. They quit monastic life as a teenager, disguised themself as a man, and assumed the identity of a page. After traveling around Spain, they booked passage aboard a vessel bound for Nueva Granada as a cabin boy. They jumped ship there, then moved on Panama, then Peru as a soldier, each step of the way forming new business and social relationships, like working as a manager for a store and helping to load goods onto ships. From there, they made a living as a soldier and an outlaw, participating in borderland wars in Chile against the Mapuche. After 20 years a soldier and ruffian, they were forced to confess the truth about their true sex, but the bishop, upon receiving word that Catalina had never taken final vows as a nun, could not arrest them for breaking those vows. Now outed as Catalina, Catalina left as a local celebrity, traveled back to Spain, and applied for a military pension from the King of Spain, which was granted. They also received permission from the Pope himself to continue dressing as a man. They later applied for passage to New Spain and lived quietly until the mid-seventeenth century as a muleteer.
Another man is Manuel Bolio, who is presented in Restall’s The Black Middle. He was born in Africa in the mid-eighteenth century, and was enslaved and sent to Yucatan. He was forced to work ranching inland in Yucatan before gaining his freedom. He married and moved to Bacalar, but made frequent trips back to Merida to be with his wife, where she continued to live. Eventually, his marriage fell apart, and he left for Havana to pursue work. From there, he traveled to and worked in Venezuela before moving on to Cartagena. He eventually married a second time, despite his first wife still leaving. He was eventually caught as a bigamist, arrested, and convicted. I bring up his life to show you also how information about people traveled. Information about people and opportunities traveled along the same lines as people. Bolio was caught because people he knew from his previous life in Yucatan passed word along to their friends, and on to the friends of friends, who recognized him in Cartagena. This demonstrates that many other people were moving along these same information networks, even though their stories are preserved in the historical record in the same way.
In both of these cases, you can see the sort of transience and movement that was available to men, as they looked for work, built family connections, found new businesses, and pursued travel opportunities. You can also see the sort of accidents of a person’s life that led to new opportunities springing up in distant places.