United Parcel Service Inc. is bolstering profit by combining efficiency gains with a torrent of package-delivery demand fueled by soaring e-commerce.

Adjusted operating profit rose to 14% of sales in the second quarter, UPS said in a statement Tuesday. Wall Street had expected 13.2%, based on the average of analyst estimates compiled by Bloomberg. Investors watch the measure as a yardstick of the company’s ability to boost its bottom line.

The Atlanta-based courier and rival FedEx Corp. are racing to profit from the rise of online shopping as the coronavirus pandemic accelerates a long-term consumer shift away from stores. The challenge is that carrying packages to homes is typically less profitable than serving businesses, where drivers often handle several packages per stop in denser route networks.

UPS forecast a full-year operating margin of 12.7%, in line with analyst estimates but lower than the second-quarter figure.

The shares were priced down 1.4% at $207 as of 6:30 a.m. in New York ahead of regular trading. They’d advanced 25% this year through Monday, topping FedEx’s 15% gain and the 17% increase of a Standard & Poor’s index of U.S. industrial companies.

UPS’s adjusted earnings rose to $3.06 a share in the second quarter. Analysts had predicted $2.83. Sales advanced 14% to $23.4 billion, in line with estimates.

Shareholder expectations for UPS’s earnings have been rising along with package demand. In a presentation June 9, Chief Executive Officer Carol Tome said the company’s operating margins would expand to as high as 13.7% in 2023, while sales would rise at a 10%-a-year clip. But the shares fell the most in six months that day as the targets left investors unimpressed.

Tome, who took the helm just over a year ago, has emphasized her goal of making UPS “better not bigger.” In one move under her leadership, UPS sold its low-margin freight business this year. She also is focusing on serving smaller firms, which tend to pay full price for shipments, and discounting less to win large shippers.

Costs have also risen because of measures to protect workers from the spread of Covid-19. In addition, Tome has ramped up spending to speed up deliveries, such as putting packages on express trucks instead of trains, to catch up with rival FedEx’s transit times.

While the hefty e-commerce demand may ease as vaccines allow people to return to stores, business packages will also increase as more workers head back to the office. Investors will be watching buying patterns this year and next to gauge how much of the shift to online shopping is permanent.

At least through this year, package demand will outstrip couriers’ last-mile delivery capacity, Tome has said.