The U.S. trade gap widened in May to the second-largest on record as imports increased faster than exports.

The gap in trade of goods and services rose 3.1% to $71.2 billion in May from a revised $69.1 billion in April, according to Commerce Department data released Friday. That compares with a median estimate for a shortfall of $71.3 billion in a Bloomberg survey of economists.