The U.S. Postal Service narrowed its losses in its first quarter that ended December as a surge in online shopping and package delivery boosted its revenues.

The agency, which has lost money for 19 of the last 21 quarters, lost $354 million in October to December of 2013, compared to the same quarter the previous year when it posted a net loss of $1.3 billion.