The economy expanded by 0.4%, official figures show, whereas analysts had predicted no growth.