Stronger consumer spending and exports helped to boost growth in the second quarter of the year.