Vietnam’s plans to vigorously police the internet took a step forward Tuesday when it adopted a cybersecurity law that requires internet companies such as Facebook and Google to store their Vietnam-based users’ data on servers in the country.

Critics say the new law could make it easier for authorities in the one-party communist state to track down critics online. Legislation passed by the National Assembly also requires internet companies to open offices in the country, which they have been hesitant to do, in addition to...