Sales at Sandy Springs-based UPS surged in the second quarter, a rarity in an economy battered by the coronavirus and stay-at-home orders.

The global shipping giant said Thursday its volume of business-to-consumer shipments soared 65% in the three months ended June 30 from a year earlier. It hired nearly 40,000 people to keep up with orders, increasing its workforce to more than 528,000 worldwide.

“At the beginning of the second quarter, we assumed demand would slow. Instead, we saw just the opposite,” UPS Chief Executive Carol Tomé said in a conference call with analysts.

She said the company experienced “unprecedented demand and record high volume levels,” fueled by residential deliveries, healthcare shipments and shipments from Asia.

The company’s share price was 14% higher at $141.66 in afternoon trading Thursday on the New York Stock Exchange.

But UPS declined to predict future revenue or earnings, citing “uncertainty around the timing and pace of the economic recovery,” particularly for business-to-business shipments.

The Commerce Department reported Thursday that the U.S. economy contracted at an annual rate of 32.9% in the second quarter. Steep downturns in other parts of the world also could affect the trade that drives UPS’ business.

“The recovery will continue to be extremely difficult to predict until the spread of the virus is better controlled and a vaccine is widely available,” said Tomé, adding the company has cut its staff in some areas, such as supply chain and freight.

Skyrocketing demand from online shoppers ordering items for delivery while they stay safe at home also comes with hurdles for UPS.

Tomé, who replaced David Abney as CEO on June 1, faces increased costs from the massive shift in demand away from bulk business deliveries to millions more doorstep drop-offs.

Still, UPS reported a better-than-expected net profit of $1.8 billion in the second quarter, up from $1.7 billion a year earlier. Wall Street analysts had been concerned about declines in the company’s profit margins.

Total revenue grew 13% to $20.5 billion, while operating expenses grew 14.7% to $18.2 billion. UPS delivered an average of 21.1 million packages a day.

That’s in contrast with some other Atlanta-based corporate giants reporting dismal results for the second quarter, including Coca-Cola, with one of the worst quarters in its 134-year history, and Delta Air Lines, which posted a $5.7 billion loss while cutting 17,000 jobs through buyouts and early retirements.

Robert W. Baird & Co. analyst Benjamin Hartford, in a note to investors, called the UPS results “perhaps the most remarkable” among transportation companies.

Boosting short-term results, UPS added surcharges amid a pandemic that has driven a sea change in the shipping industry.

“We are operating in a very difficult environment and we have a lot of work ahead of us to increase profit per piece,” which was down 19.3% from a year earlier, Brian Newman, UPS’ chief financial officer, said on the conference call.

Tomé said many more changes are on the way.

“Our customers are changing, our competitors are changing and the rate of change is accelerating,” Tomé said. Outside of the company’s core principles, “everything else in our portfolio is under review. And I mean everything.”

She said UPS recently opted not to buy more Boeing 747 jumbo jets, which are going out of production, because adding more cargo planes to the fleet could create excess capacity.

Industry analysts have also said with the cost of shipping could rise as e-commerce grows and small shipments to homes replace pallets delivered to retailers.

Human workers, meanwhile, face growing competition.

Tomé voiced interest in more automation at UPS package sorting facilities and said she reviewed a robot that can put labels on packages. The robot is not yet ready for market, but its productivity is “about 50% higher than a human being.”

Payroll is “the largest expense we have,” she said. “We need to double down to how we can automate the inside of our facilities to drive more productivity.”

Tomé, a former chief financial officer at Home Depot, also plans to tap lessons from her previous job.

“When cost increases come your way, if you are a large retailer you can pass those cost increases [across products] and the customers don’t know,” she said. At UPS, “there’s an opportunity on the pricing side to do what we need to do.”