A shock defeat to Croatia saw Spain lose out on top spot in Group D after starting the tournament in impressive fashion with victories over Czech Republic and Turkey.