The advert mimicked a horror film and showed young people being menaced by a scary doll when they played a particular song.
In its ruling, the Advertising Standards Authority (ASA) said the setting and events were "particularly likely" to scare younger viewers.
Spotify has been told to make sure its future adverts are fit for children to watch and are targeted appropriately.
In a statement, Spotify said: "We acknowledge the ruling from the ASA and regret any distress the ad may have caused the complainant."
The advert ran on YouTube in June 2018 and featured several scenes of young people regularly playing the song Havana by Camila Cabello.
The video shows the music also waking a "horror film style doll" that then pops up and scares the characters every time the track is played.
The ad generated a complaint that it:
- had caused distress to a child
- was being shown on a YouTube channel younger viewers were likely to watch
And the ASA upheld both of these complaints "in part".
The implied violence in the clip, its music, the reactions of the characters and the abrupt ways the doll appeared all served to make it likely to scare children, said the ASA.
"The fact that the ad was set inside a home, including a bedtime setting, and featured a doll, meant it was particularly likely to cause distress to children who saw it," it said in its ruling.