Mexican media giant Grupo Televisa announced on Monday that it will invest $1.2 billion in Univision in exchange for a stake in the U.S.-based Spanish-language broadcaster and a new content-sharing agreement between the two companies.

As part of the deal, Televisa will get a stake of up to 40 percent in Univision. The $1.2 billion investment includes a 5 percent equity stake and debt that can convert into an additional 30 percent equity stake, according to a joint statement issued by both companies. Televisa, known for its “telenovela” soap operas, also has the option of buying an additional 5 percent stake in Univision over the next five years, bringing its total interest, ultimately, to 40 percent.