The wider campaign revolves around the idea that every song has a particular significance to its listener, and can be a powerful reminder of a place or moment.
Spotify’s TV ads will air until the end of November, with two running each week. The first will tell a story, and the second will be related to that week’s X Factor theme.
The action in the first ad, which breaks this week, revolves around getting friends in a bar on a night out to sing Queen's Bohemian Rhapsody. The second ties in with X Factor’s Hallowe’en-inspired 'Fright Night' theme.
The campaign will be supported across several channels, including a dedicated #thatsongwhen campaign hub. Users are encouraged to share their own stories by choosing a song, image or video clip, and then posting it on social media.
Spotify will also run dynamic banner ads, social-media activity and dedicated playlists on its own platforms.
"This campaign was born out of the insight that 'every song has a story'," said a Spotify spokeswoman. "Music is extraordinarily powerful as a reminder of a moment in time, and we wanted to encourage music-lovers to share their music stories with us."
She added: "We're using The X Factor to connect music to moments and to get users to share and engage in the conversation around that."
This is the first time Spotify has run TV ads in the UK, but the activity follows a similar storytelling campaign in the US.