Mariana Vitória was part of a mutual trade between Spain and Portugal. Maria Barbara of Portugal went to Spain and married Fernando, Principe de Asturias while Mariana Vitória went to Portual to marry José, Prince of Brazil (both titles meant heir apparent much as "Prince of Wales" does). Both grooms became Kings and both brides became Queen-Consorts. Fortunately, both couples had successful marriages. Mariana Vitória's Wikipedia article is here.