It's one of the most memorable moments in 1998 comedy There's Something About Mary.

Cameron Diaz uses an unlikely and very gross substance to style her bangs before going out on a date with Ben Stiller.

And on Saturday Miley Cyrus appeared to mimic the infamous 'hair gel' 'do in a topless selfie she shared to Instagram.

Channelling Cameron: Miley Cyrus shared topless Instagram snap on Saturday as she resembled the famous 'hairdo' from There's Something About Mary

Sticking out her tongue, the 21-year-old poses in front of a mirror in nothing but her panties as her hands - and a carefully placed digital cartoon pastie - protects her modesty.

She then shared another snap of herself in a bra and panties as she reclines on a bed, with the hashtag '#postshowerinstagramwhoreselfielife'.

Miley's look in the first snap was reminiscent of an infamous and over-the-top scene in There's Something about Mary, where Stiller's character Ted has an accident in the bathroom only to have it discovered by Mary as it dangles from his ear when she picks him up for a date.

Inspiration? Miley's updo was reminiscent of Cameron Diaz's in 1998 film There's Something About Mary

The blonde beauty mistakes the fluid for hair gel and plasters some of it into her locks, creating an unforgettable updo.

Meanwhile, Cyrus was in the Spanish town of Barcelona with her 14-year-old sister Noah, on Thursday.