WASHINGTON—The U.S. government posted the highest surplus on record in April, although the federal deficit over the past several months widened as spending rose along with revenues.

Government revenue rose by 12%, or $55 billion, in April from the same period a year earlier, the Treasury Department said Thursday. That brought April’s surplus to $214.3 billion, the largest April surplus on record.

More...