What did Spain do to establish colonial government?

spain divided it's american emprie into two provinces these provinces were named new spain and peru.