Spain's government effectively nationalized one of the country's largest banks, Bankia, late on Wednesday, after days of uncertainty over the lender's viability.