If you study Brazilian History as well (I am Brazilian and I have read some very good Brazilian history books), you see that in Brazil many of the provinces had separatists feelings, in several occasions along the time. I will not mention examples, but there are dozens of rebellions that happened along the XIX century. And even in 1930 we had an armed "Revolution" in São Paulo state, with strong "autonomous" feelings.
But the fact that we had a "strong" personality king in the XIX century (arguably not a wise king, but a vigorous one), especially on the early days of Independence, that repressed the rebels, helped to keep the union. In many other occasions, the "central government", based on Rio de Janeiro, managed to contain other revolutionary instincts/actions as well.
In resume, when one reads about Brazilian history, one can realize that for several occasions we were on the verge of getting fragmented in a similar way to what happened with the Spanish colonies, but for many particular reasons, along the time, the central government managed to keep the unity.