The correct response is: The Spanish established their language when they colonized the territories.
Spanish became the official language of many South American countries due to the colonization by Spain, which began in the late 15th century and continued over the following centuries. This led to the widespread adoption of the Spanish language across these territories.