United Parcel Service Inc. plans to charge retailers extra fees to deliver packages during the busiest weeks before Christmas, creating a new challenge for an industry already coping with a shift away from traditional stores.

The surcharges, announced Monday, are a shot across the bow for retailers, including giants such as Wal-Mart Stores Inc. WMT 0.42% and Macy’s Inc., that have been ramping up their e-commerce businesses as they seek to offset declining foot traffic to shopping centers. It also adds to the costs of Amazon.com Inc. AMZN 2.49% and other online players, which rely on UPS and rival FedEx Corp. to handle a surge in holiday shipments.

The fees will force retailers to decide over the next few months whether to raise shipping prices—something that is difficult to do when online shoppers are reluctant to pay shipping fees—increase the prices of goods or eat the extra costs themselves. Some may seek to avoid the surcharges by spreading holiday deals to other weeks during the season.

Patrick Gill, chief executive of the high-end fishing gear site TackleDirect.com, said news of the surcharge was frustrating since it is going to be applied when his site needs lower rates to compete against Amazon.com, Wal-Mart Stores and others.

“This will add up to be another unaccounted for expense during the holiday season,” Mr. Gill said. “It will force us to push some product away from UPS in some cases.”

For UPS, the move signifies a need to get paid for a service that has become an integral cog in the holiday shopping period, when it must add planes, trucks and thousands of staffers.

While Amazon and countless other websites are the front door to millions of products on the web, UPS, FedEx and the U.S. Postal Service do the heavy lifting that eliminates trips to stores and delivers packages to homes.

UPS said it had to impose the charge to offset the additional cost of delivering packages.

The company is “trying to make sure they are, at the margin, getting compensated for stretching their network,” said Sanford C. Bernstein analyst David Vernon, adding that the carriers have the power to raise prices given how critical they have become to the period. “Without them, Christmas kind of doesn’t happen.”

Some analysts expect FedEx to follow in some way, as the two rivals often take pricing cues from each other. A FedEx spokesman declined to comment. The company reports its fiscal fourth-quarter earnings Tuesday.

The surcharges unveiled by UPS will hit its customers during the busiest shipping weeks and on the most popular products during that time. Between Nov. 19 and Dec. 2—the weeks encapsulating Black Friday and Cyber Monday—UPS is adding a 27-cent charge on all ground packages sent to homes.

Ground orders typically arrive within five days and are a heavily used shipping option during that time since shoppers don’t necessarily need the items quickly.

Last year, UPS collected on average $7.97 in revenue per item shipped in its U.S. ground network.

The peak surcharges won’t be in effect for the following two weeks, when shoppers typically take a pause, but they will return for the final holiday rush. From Dec. 17 to Dec. 23, UPS will charge an extra 27 cents for each ground shipment, 81 cents for next-day air and 97 cents for two- or three-day delivery.

In a twist, the UPS surcharge includes an element that gives stores an advantage.

The charges apply only to residential deliveries, so retailers and shoppers may be able to avoid the charges by getting orders shipped to stores, an option retailers have been pushing for the past few years with varying success.

UPS Chief Commercial Officer Alan Gershenhorn said the per-package cost will only “marginally increase” during the holiday period. As an example, UPS said a five-pound next-day air package from Atlanta to Philadelphia will cost 1% more to ship. Another example offered by UPS showed a 2% increase with the added fee.

UPS daily volume swells to more than 30 million in the weeks before Christmas versus more than 19 million on a normal day. Citi Research estimates the new surcharges will add $50 million in revenue and profit at UPS this year.

The carrier declined to provide a projection on the revenue impact from the surcharges, but said it already was factored into its outlook. The company had more than $60 billion in revenue last year.

Shippers may try to avoid the surcharge by offering more deals in October and early November, or by negotiating a discount. “The real objective for the surcharge is to motivate shippers to do their part in avoiding such volume increases,” said Satish Jindel, president of ShipMatrix Inc., a software provider that analyzes shipping data.

UPS, FedEx and the U.S. Postal Service are all looking to recoup massive investments they are making in their delivery infrastructure to accommodate the surge of packages flowing into their networks in recent years as more people shop online.

UPS is spending $4 billion this year alone as it automates more package-sorting hubs and opens new warehouses.

UPS is looking at other ways to recoup costs during peak periods, so it isn’t left holding the bag for the additional investments. Last month, UPS CEO David Abney said the carrier is negotiating with retailers to help them pay for the any additional investments, even the capacity goes unused.

On Monday, UPS said will also impose surcharges on all large packages above a certain threshold, which cost more to ship and sort, throughout the entire period. Those surcharges will be more onerous, tacking an additional $24 fee to an existing surcharge of $70 for a package weighing more than 150 pounds and over a certain size.

UPS also will charge a peak surcharge of $249 per package on the largest packages, on top of a $150 fee for such “overmax” packages. A UPS spokesman said that such items only represent a small sliver of packages, since most are shipped through its freight business.

The company is encouraging shippers to instead send such packages through its freight network, where it recently imposed a second 4.9% increase in shipping rates the past year.

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