Taylor Swift electrified the crowd at the iHeartRadio Music Festival this weekend, but the singer had a slight wardrobe malfunction when opening her set.

All eyes were on the 22-year-old as she kicked off her performance with a rendition of 'Sparks Fly,' walking down a long staircase through the audience. Wearing a sparkly sequin outfit, she graciously came face-to-face with fans, holding their hands as she sang.

However, the right shoulder strap of her dress came undone before she made it to the stage (you can see it just after the 2:40 mark in the video below). Thankfully, Swift was wearing a sequined shirt underneath so nothing was exposed, but, with the cameras on her, it was clear that the malfunction was a distraction to the singer.

Ever the professional, Swift was able to tuck the front panel of her dress and continued the opening number without missing a beat. Later, she performed 'You Belong With Me' without the gold gown, dressed in the embarrassment-saving glittery top and a pair of black shorts.

What's the lesson here? Always dress in layers! Swift also treated the crowd with performances of 'Mean,' 'Love Story' and her latest single, 'We Are Never Ever Getting Back Together.' The star's new album, 'Red,' is due out on Oct. 22.

Watch Taylor Swift's iHeart Festival Performance