A longtime UPS driver was hailed as a hero for calling cops after he spotted a woman’s desperate plea for help scrawled on a package — saving her from being held captive and sexually assaulted by her husband in their Missouri home, authorities said.

Sgt. T.J. Wild of the Franklin County Sheriff’s Department told KMOV.com that the unidentified driver “made a huge difference” in Tuesday’s arrest of James Jordan, 33, of Robertsville.

Investigators said the driver went to Jordan’s home after being called to pick up a package and took it at the front door from Jordan’s wife, who had written “contact 911” on it. The driver then left the home and alerted authorities.

UPS officials said in a statement to The Post that the driver instinctively did the right thing.

“We are grateful this UPS driver with more than a decade of service followed protocol when he saw a customer in distress and contacted authorities after he saw her message to contact 9-1-1,” the statement read. “Our drivers are very familiar with their routes, and are trained to be aware of their surroundings and respond to requests for assistance.”

The woman’s harrowing ordeal began late Monday, according to court documents, when Jordan allegedly prevented her from leaving their home or using the phone. Jordan allegedly beat her, put a gun to her head and threatened to kill her. He also allegedly dragged her back into the home by her hair when she tried to escape, KMOV.com reported.

The couple’s 3-year-old child allegedly was locked inside a room for several hours as the abuse went on, according to the Franklin County Sheriff’s Department.

A SWAT team was called to the home and eventually took Jordan into custody. He later was charged with domestic assault, sodomy, felonious restraint, unlawful use of a weapon and endangering the welfare of a child.

He is jailed on $100,000 cash bond, authorities said.

Remember when this man was locked in a basement for 20 years?