Spain’s new prime minister on Wednesday unveiled a government that has more women than men and includes a foreign minister from Catalonia who has led the fight against the region’s independence movement.

After meeting with King Felipe VI, Prime Minister Pedro Sánchez told journalists that his team was “a government for an equal society, open to the world but anchored in the European Union.”

Mr. Sánchez took office after winning a parliamentary vote of no confidence against former Prime Minister Mariano Rajoy, whose Popular Party was embroiled in a corruption scandal. Mr. Sánchez’s tenure could, however, be short-lived and pave the way for new national elections as his Socialist party has only a quarter of the seats in Parliament.

His first challenge is to keep together his unwieldy alliance with a far-left party and nationalist parties from the Catalonia and Basque regions, which helped him unexpectedly replace Mr. Rajoy as prime minister.