While the answers telling you that what matters is your advisor and the research you do in graduate school, not the institution, are in a certain sense right, I feel like the underlying message of them is pretty misleading (or at least incomplete).
It seems worth mentioning, first off, that professional mathematicians working in the US who got Ph.D.'s in Latin America are extremely uncommon. I'm sure there are some, but I literally cannot think of any off the top of my head. In fact, professional mathematicians in the US who got Ph.D.'s anywhere outside North America or Europe are incredibly rare. Look through the faculty of any math department you like, see if you can find any. There will be a fair number of faculty who were born or grew up or even got a bachelors in another country, but very few who got a Ph.D. outside the US. Actually every time I've done this, the number of schools outside, say, the top 10 ranked graduate programs in the US that appear is always terrifyingly low.
Now, it's actually quite hard to conclude anything from this exercise, since it is obviously an uncontrolled experiment. I suspect that part of what's going on here is that if you're in Latin America, and you're interested in moving to the US to advance your career in math, you won't wait until after graduate school. In general, for both intellectual and funding reasons, US graduate programs are the most attractive in the world, so that's usually the point where someone who's open to moving will do so. Similarly, probably the most important reason why the best-ranked schools show up so often is that they take the best students into their program.
So, that doesn't prove that you can't go to any institution and be successful. However, I wouldn't underrate the importance of the institution you go to in terms of shaping your ability to do good research and develop the kind of network you need. Being with the very best students (at least in my opinion) has a very big effect in and of itself. Being in the US gives you access to conferences and networks of people in the US, which is what you want to build if you want to be there long term.
Also worth thinking about: what kind of teaching experience will you have at the end of your degree? If you want to be able to get a job at a teaching focused institution, you need to have teaching experience, and you need to have people who can credibly vouch for it. Are you going to be able to get that in Brazil?
So, I would remember: you don't have to start a Ph.D. right after your B.A. It might make more sense to get a job, or work on mathematics unofficially if your wife is only going be in Brazil for a couple of years. If it's going to be for longer, then you have a trickier choice.