Legendary rapper, producer, and actor Eminem thanked his fans for helping sustain him through dark times when he was struggling with drug abuse, depression, and tenuous relationships with his family during a performance in New York City Thursday night.

Addressing hundreds of screaming fans crowding the stage of Hammersteain Ballroom, the 39-year-old rapper said that "wouldn't have gotten out of that dark place without y'all," the Associated Press reports. He then went on to perform his Grammy award-winning song "Not Afraid." He told the crowd that his performance was "dedicated to anybody tonight who's been through personal struggles."

Eminem's music has long referenced his prolific prescription drug abuse. As the Rolling Stone review of "Relapse," put it: "Em's first album in nearly five years, is studded with brand names, but not Lexus or Cristal-more like Lunesta, Ambien, Vicodin, Valium, NyQuil and other brain candy that helped Marshall Mathers turn himself into a zombie, before he got clean last year."

His 2010 album "Recovery" continued the trend the artist began with 2009's "Relapse" of documenting his effort to finally become sober with brutal honest-so much so that his newfound earnestness jibed unpleasantly with his former gleefully and carelessly offensive persona. Pitchfork's review of the album, for instance, said that "for the first time in his career, he actually sounds clumsy." Despite the divisive critical response, "Recovery" still went on to become the best selling album of 2010, according to Billboard.

Eminem performed over a dozen songs at the Hammerstein Ballroom for an event sponsored by the watch brand G-Shock, including the his hit songs "Lose Yourself," ''Love the Way You Lie" and "The Real Slim Shady."

The hip-hop foursome Slaughterhouse, a musical supergroup of sorts that contains Eminem's friend and fellow Bad Meets Evil member Royce da 5' 9'', opened for the Detroit-born rapper.

Watch the video of Eminem thanking his fans below.