April 1 (Reuters) - United Parcel Service said on Monday it will become the United States Postal Service's (USPS) primary air cargo provider, as rival FedEx announced an end to its more than 20-year partnership with the postal service provider.

USPS was the largest customer for FedEx's air-based Express segment, even as payments declined after the postal service shifted letters and packages from planes to more economical trucks as part of an operational revamp.

"It's not a huge loss for FedEx, but it will impact their density... You're losing consistency in terms of revenue from a pretty significant partner, but it wasn't the most profitable business for them ... it's not all negative," said Faisal Hersi, an equity analyst at Edward Jones.

USPS represented just about 4% of Express' annual revenue, according to a Reuters calculation.

The contract win is seen as a boost to UPS. The parcel delivery company had in January forecast full-year revenue below Wall Street's estimate.

"It provides an opportunity (for UPS) to have someone that's going to guarantee them some of that volume and helps them have that density improvement," said Hersi.

The financial terms of the contract were not disclosed but UPS said it was "significant."

Shares of FedEx, which expects to see profitability improve in fiscal 2025, fell nearly 2%. UPS' stock was 1% lower.

FedEx will also make adjustments to its network to make up for the loss of the contract that brought in nearly $2 billion in annual business.

"The parties were unable to reach agreement on mutually beneficial terms to extend the contract," the company said in a filing on Monday.

As many as 300 pilots at FedEx could be out of work if the contract ended, trade publication FreightWaves said in January citing a recording of a meeting between a FedEx executive and pilot evaluators.

"With each new announcement, FedEx management continues to threaten every FedEx employee's job security and quality of life," said the Air Line Pilots Association International (ALPA), the union representing FedEx pilots.

"FedEx continues to spend billions in stock buybacks while simultaneously announcing layoffs of employees who have helped build it into the brand it is today," ALPA added.

USPS' payments to FedEx shrank to about $1.7 billion in fiscal 2023, from $2.4 billion during the fiscal year ended September 2020.

As the No. 1 USPS domestic air contractor, FedEx had supported the agency's Priority Mail and other quick services.

The agency is reorganizing to accommodate customers who are adopting Amazon.com's strategy of moving distribution centers closer to people who buy their products. That proximity meant that fast deliveries have less need for air services.

(Reporting by Ananta Agarwal and Deborah Sophia in Bengaluru; Additional reporting by Shashwat Chauhan and Aishwarya Jain; Editing by Sriraj Kalluvila and Krishna Chandra Eluri)