NFL star Aaron Hernandez — who had just inked a $40 million contract extension — threw his promising career away with “the execution” of an acquaintance in Massachusetts, prosecutors said yesterday.

Hernandez, 23, was punted by the New England Patriots less than two hours after he was charged with murdering semipro football player Odin Lloyd, 27.

The Pro Bowl tight end cost himself more than $25 million in potential future earnings and the remaining $3.25 million of his signing bonus.

Hernandez, who signed a five-year contract extension last year, faces life in prison if convicted.

Lloyd’s body was found in an industrial park near Hernandez’s Attleboro house on June 17. The victim had been dating the sister of Hernandez’s fiancée.

Prosecutors said the slaying stemmed from a beef at the Boston club Rumor on June 14. Hernandez was furious that Lloyd had struck up a conversation with men with whom he had been fighting.

Hernandez “orchestrated the execution. And that was just what it was,” Assistant District Attorney Bill McCauley said.

MURDER CHARGE A REMINDER OF NFL’S DARK SIDE

On June 16, Hernandez texted two out-of-state pals and asked them to come to Massachusetts — telling them, “You can’t trust anyone anymore.”

When they arrived from Connecticut, the muscle-bound athlete left his home, and the three men picked up Lloyd at his house at around 2:30 a.m.

They cruised around and talked about the night in question at the club.

Lloyd got nervous and texted his sister, “Did you see who I am with?” When asked who, he wrote “NFL.”

His last text read: “Just so you know.”

Workers at the industrial park where the body was found heard gunshots between 3:23 and 3:27 a.m., prosecutors said.

Five casings from a .45-caliber gun were found near Lloyd’s feet, authorities said.

Prosecutors didn’t say whether Hernandez was the one who pulled the trigger. The identities of the other two men in the car were not released.

Hernandez is seen on his home-surveillance video returning after the shooting carrying a gun, prosecutors said. But hours of footage is missing — and was reportedly destroyed.

Hernandez was ordered held without bail. He pleaded not guilty to murder and five weapons charges.

Lloyd’s relatives sat up front in court, and two tearful family members left the courtroom as McCauley laid out the details.

But Hernandez showed no emotion and rocked back and forth with his hands cuffed in front of him.

His lawyer, Michael Fee, referred to the “hysterical atmosphere that has surrounded the case,” and called the evidence “circumstantial” as he argued unsuccessfully for bail.

“Aaron is fine,” he told reporters outside court.