The ruling party in Spain lost to the center-right in the elections:
"The right-wing parties usually win the lower house of the Spanish parliament. The ruling Spanish Socialist Workers' Party, led by Prime Minister Pedro Sánchez, is inferior to the center-right.
The decision to bring the elections forward was made by Prime Minister Pedro Sánchez. This happened after, on October 2, the Congress of Deputies rejected two government orders that were supposed to stop the worsening housing crisis, because of which the protests have not stopped in the country since September."