Sorry to continue the hijack:
Brazil is probably most analogous to the US. They ended slavery in 1888. The biggest difference is that there was a larger free black population in Brazil already than in the US. While Brazil didn’t go to war over this, it did take a war to accelerate the process: the war with Paraguay, which gave many blacks (who fought in it) a taste of freedom; many didn’t return to being enslaved after it ended.