Dubbed “Ooh La La,” the song will play over the end credits of the film, which hits theaters July 31.
“I always loved the Smurfs as a kid and now my boys are the biggest Smurfs fans EVER,” Spears said in a statement. “I wanted to surprise them with a song in the movie. I know they’ll think it’s Smurftastic!”
Lia Vollack, president of Worldwide Music for Sony Pictures, added, “We are completely thrilled to have Britney involved with The Smurfs. She is an amazing artist and her boys are Smurfs fans, so it’s a great fit for all of us.”
Spears most recently ankled Fox’s reality show competition “The X Factor” to focus on her music.
She is repped by CAA.