Videos posted on social media with hashtags #InMyFeelings and #DoTheShiggy show people performing dance moves to fit with the lyrics of the song, with many even leaping from their cars before starting to dance.
Some videos end badly, with the vehicle hitting a street sign or a pedestrian.
The dance challenge was created at the end of June by US social media personality Shiggy and it has been taken up by celebrities such as actor Will Smith and Real Madrid's Brazilian star Marcelo who have posted videos of themselves doing silly dance moves along to the song.
But the regional police force in Spain's northeastern region of Catalonia, the Mossos d'Esquadra, has warned that "doing a challenge such as #InMyFeelingsChallenge could end in criminal charges" if it violates traffic
"'Road safety is not a game!'," they said in a Twitter message which recalled that you can be fined for not wearing a seatbelt, driving without paying due attention or recording on a mobile while driving.
⚠ Fer un repte com #InMyFeelingsChallenge pot acabar en denúncia— Mossos (@mossos) July 20, 2018
⛔ Gravar amb el mòbil mentre condueixes
⛔ Conduir sense parar atenció
⛔ Descordar-se el cinturó en circulació
⛔ Posar en perill a tercers
‼ La seguretat viària NO és cap joc pic.twitter.com/iJjKQ4d1fq
Spain's General Traffic Authority also warned against it tweeting this:
¿Conoces el último reto viral #inmyfeelingschallenge? Consiste en bailar🕺mientras el coche está en marcha, colgarlo en redes y exponerte, como mínimo, a una sanción 🚔🚨👮.— Dir. Gral. Tráfico (@DGTes) July 23, 2018
Nos encanta que bailes y te diviertas, pero no pongas en riesgo tu #seguridad. #NoSigasSuEjemplo pic.twitter.com/viaSBK8yBs
Meanwhile, local police in Boadilla del Monte, a wealthy suburb west of Madrid, have urged drivers who want to take up the challenge and "demonstrate their dance challenges" to "do it with the car parked" in a separate Twitter message.