King Felipe VI presided over the short ceremony, which marked the inauguration of an administration led by Socialist leader and Prime Minister Pedro Sánchez that ranges from the political center to the far left.
Five ministers come from the anti-austerity United We Can party. The leader of that party, Pablo Iglesias, is one of four deputy prime ministers in the new, enlarged Cabinet.
Sánchez has set as goals of the new administration achieving social reforms, sound economic growth and "dialogue" with separatists in northeastern Catalonia.
One by one, the 22 ministers all promised to follow the Spanish Constitution and to be loyal to the monarch.
Sánchez, who had led a brief minority government since mid-2018 but was a caretaker for most of the past year, was forced to accept members of the United We Can party after losing ground in a repeated election in November.
In order to win the endorsement of parliament to form a new minority government, he also had to agree to opening talks with the separatist-led regional government of Catalonia, which wants to break with the rest of Spain. That has earned him severe criticism from the three right-of-center opposition parties.
Coalition governments have become a norm in many European countries. But in Spain, a conservative party and the Socialists have taken turns in power since the return of democratic rule in 1978 following the death of dictator Gen. Francisco Franco in 1975.