Why is Spain safe than Latin America?

When I ask the people I know that have moved to Spain what they like more about there they say that the safety and that armed robbery is uncommon unlike Latin American cities, the most dangerous thing that happens usually is pickpocketing and that people walk at 2 am without fear of being mugged. What does Spain makes that we don't? Its because of thougher laws?