Gross domestic product expanded at a faster pace than most economists forecast in the first quarter, after shrinking the most in a century last year.