The Economist Intelligence Unit analyses 60 cities across the world and ranks them in order of personal safety, healthcare, security infrastructure and digital security.
Tokyo is the safest city in the world but Barcelona and Madrid lead the table in terms of security infrastructure in buildings, bridges, roads and emergency services.
Barcelona has gone up seven positions since last year despite the terrorist attacks on La Rambla that killed 13 people and injured 130 others.
The report also highlighted that cities are more vulnerable the more they adapt to digitalisation as they are susceptible to hackers.
At the bottom of the safety table are Middle Eastern and Asian cities, such as Dacca (Bangladesh), Rangoon (Myanmar), Karachi and El Cairo.