Mariah Carey shared words of praise with Lil Nas X after he broke her long-standing Billboard Hot 100 record.

On Monday, the rapper's "Old Town Road (Remix)" with Billy Ray Cyrus set the record as the longest-running Billboard Hot 100 No. 1 single of all time at 17 weeks. Carey previously set the record, which was 16 weeks, for more than 10 years with "One Sweet Day," her 1995 duet with Boyz II Men. Luis Fonsi, Daddy Yankee and Justin Bieber's "Despacito" tied with "One Sweet Day" in 2017.

>> Read more trending news

"Sending love & congrats to @LilNasX on breaking one of the longest running records in music history!" Carey tweeted Monday. "We've been blessed to hold this record with a song that means a great deal to @BoyzIIMen and myself and has touched so many. Keep living your best life!"

Lil Nas X responded in kind, tweeting, "Wowwww thank you so much Mariah! you are a legend and an icon and I’m blessed to even have you acknowledging me right now! growing up to your music & now having you talk to me directly is unreal!"

The inspiration for the song, initially released as a solo single in December, came when the now-20-year-old rapper was at a low point in his life, according to an Instagram post the musician made after setting the Hot 100 record.

"Last year in October, as a struggling artist starting to lose faith in what I could be, I went looking for beats on youtube. I remember clicking on so many generic sounding beats trying to find the right one for me," he wrote. "When suddenly I came across a country-trap sounding masterpiece. I immediately knew I would make something special out of it!"

What You Need to Know: Lil Nas X

Nas X said his sister said he would have to leave her home soon as he had been there for months working on his music online.

"I was so upset I used it as motivation for the song! I jokingly/seriously saw myself as a loner cowboy needing to run away from it all! I went out on my sister’s back porch and listened to the beat OVER & OVER & OVER!! then it came to me!! in my best singing voice I sung “YEAHHH IM GONNA TAKE MY HORSE TO THE OLD TOWN ROAD IM GONNA RIDEEEE TIL I CANT NO MORE” I LOVED IT ALREADY! I started to work on it EVERY SINGLE DAY."

Nas X said the song needed to be hip-hop, country, catchy and short. He was in his brother's house by the time he finished the song and went into the studio on December 2 to record the song, putting it on SoundCloud the same day, where it began to gain momentum.

"Did I know it would become the longest running number song of all time? NO!‼ but I am so thankful that this blessing has been placed upon me. this song has changed my life and the way I see the world around me in less than a year. thank you to every single person who has been apart of this journey. as I said before, it’s just the beginning!"