MARIO LOPEZ will pay a steep price if he ever cheats on new bride Courtney Mazza – $5 million, to be exact.

The 39-year-old “X Factor” host married longtime fiancee Courtney, 31, in a splashy beachside ceremony in exotic Punta Mita, Mexico, with their 2-year-old daughter Gia serving as flower girl on Dec. 1. But before walking down the aisle, sources say Courtney made him sign a prenup that penalizes him $5 million if she ever catches him cheating!

And Courtney has reason to be cautious! Back in 2004, The ENQUIRER broke a world­wide exclusive with photos of lady-killer Mario cheating on Ali Landry with a bevy of hot blondes the day before they wed – and it led to the marriage being annulled after only two weeks.

“Courtney isn’t taking any chances,” said a source. “She wouldn’t even allow Mario to have a bachelor party.”

The source notes that Courtney and Mario “are incredibly in love and have been living together as if they were married for years.

“BUT she’s determined not to be a casualty. She knows Mario’s a hot guy and that women throw themselves at him.

“She decided she was in no rush to get married. And when Mario started pressur­ing her, she finally agreed, but made sure if he ever cheated on her it was going to cost him big-time.” The $5 million no-cheating clause represents about half of Mario’s net worth, the source says.

The nuptials, which were recorded for a TLC special, were attended by Mario’s good friend, actress Eva Longoria, and featured the couple’s adorable toddler front and center.

“Mario and Courtney are very happy, and they’ll stay that way as long as Mario under­stands the rules,” the source added. “Court­ney’s determined to keep him a one-woman man.”