By Paul Ziobro

United Parcel Service Inc. rode a pandemic-fueled surge in e-commerce to higher profits and a 13% jump in revenue during the June quarter, and its new boss said the delivery giant has room to raise rates on retailers relying on its network.

UPS said its average daily shipping volume rose 21% in the quarter, faster than the company has ever recorded, with a 65% increase in shipments to homes.

The magnitude of the jump was a surprise to UPS, which had been planning for demand to pull back from the high levels in the early days of the pandemic.

"At the beginning of the second quarter, we assumed demand would slow," Chief Executive Carol Tomé said on Thursday's earnings call. "Instead, we saw just the opposite."

The results boosted shares more than 12% in Thursday's trading to records.

UPS and rival FedEx Corp. are being inundated with millions of extra daily packages after many retail stores were temporarily closed, pushing people to shop online for everything from toilet paper to pet food. Even as most stores have reopened, some shoppers remain reluctant to head to stores as coronavirus cases rise in parts of the U.S.

UPS has benefited from handling packages for Amazon.com Inc. after FedEx cut ties with the e-commerce giant last year.

UPS said it also had an increase in Covid-19 related health-care shipments and an increase in outbound packages from Asia.

The sudden growth comes at a cost, though, as the carriers incur greater expenses from more miles driven and fewer packages delivered per stop as they deliver more to homes instead of businesses.

Despite the surge of packages in the U.S., UPS's operating profit fell slightly in its main domestic segment. UPS's average revenue per package in the U.S. dropped 4.4% from a year ago, as shipments using one of UPS's lower-priced services nearly doubled.

The company expects its margin to fall further during the second half of the year, due to higher costs to handle the demand as well as some projects to speed shipping times on certain routes. Such improvements, as well as continuing to expand weekend operations, should give UPS enough bandwidth to handle what is expected to be a challenging holiday season.

"We have capacity to handle the peak volume that we are anticipating this year," Ms. Tomé said.

Both UPS and FedEx are trying to offset some of the costs with new surcharges on large packages and on some of their lower-priced shipping services. The two companies have also started to impose higher rates on some of their shippers whose volumes have changed significantly in recent months.

Investors have been looking for signs that the carriers would start to wield their greater pricing power and extract to see higher returns from billions of dollars of investment in recent years on upgrading their networks with added capacity and more automation. The pandemic has sped up the timeline under which that was expected to occur amid the significant shift to online shopping in just a matter of weeks.

Ms. Tomé, in her first remarks to investors since becoming CEO in June, said the company has room to raise shipping rates on large retailers, who she said can pass them along to consumers by raising prices.

"While retailers may squawk at price increases that come their way, large retailers have a way to spread that across and nobody knows," said Ms. Tomé, who previously served as chief financial officer at Home Depot Inc.

Ms. Tomé also said several times Thursday that UPS will focus on becoming "better, not bigger." That includes more carefully scrutinizing plans to add capacity to its network. She said UPS recently turned down the chance to buy additional aircraft because it would create more capacity that it would have to fill.

"What we have done in the past is built capacity or bought capacity in the hopes that demand would follow, and we would take demand at any cost or any price," she said.

For the period, UPS reported a profit of $1.8 billion, or $2.03 a share, up from $1.7 billion, or $1.94 a share, a year earlier. Excluding some restructuring charges, UPS said adjusted earnings were $2.13 a share. Revenue hit $20.5 billion. Analysts polled by FactSet expected UPS to post earnings of $1.07 a share, on revenue of $17.5 billion.

Write to Paul Ziobro at Paul.Ziobro@wsj.com

Corrections and Amplifications

This article was corrected at 11:59 a.m. ET because it misstated that UPS's average revenue per package dropped 5% in the second quarter. It dropped 4.4%. It also misstated that UPS's revenue hit $20.3 billion. The revenue was $20.5 billion.