Cameron Diaz has revealed one of her favourite ways of staying in shape – having sex.

The 42-year-old Sex Tape star – who recently married Good Charlotte rocker Benji Madden – opened up to Cosmopolitan UK magazine’s Love Your Body issue about how she achieves her enviable figure.

Cameron said of getting a workout between the sheets: “It’s something healthy that we need to be doing for many different reasons.”

The actress – who is also a big Pilates fan – last year published The Body Book: The Law of Hunger, the Science of Strength, and Other Ways to Love Your Amazing Body.

Cameron said the key to getting fit is learning to enjoy exercise.

She said: “You have to just do it. Once you commit and really put in the effort, your body goes, ‘Oh, it’s not OK to be without this.’

“People say, ‘My body rejects exercise.’ No, it doesn’t. Your mind rejects exercise.”

But Cameron still allows herself the odd treat.

She said: “Well-being is an equation. Remember, you don’t have to have the whole cake, you can have a piece. Don’t deprive yourself. Have fun. Just be self-aware.

“If your equation is 80 per cent good, 20 per cent bad most of the time, then a little movement toward the centre isn’t going to affect you much.”

Despite using social media, Cameron admits she is not a fan.

She told the mag: “I think social media is a crazy-ass experiment on society. The way people use it to get validation from a bunch of strangers is dangerous. What’s the point?”