Spain's progressive government was dealt a costly legislative defeat on Friday when lawmakers rejected a package of emergency measures aimed at tackling the nation's housing affordability crisis, while protesters marched on the Parliament demanding help for renters.