Tom Petty has been given songwriting credits for Sam Smith's hit song, "Stay With Me."

According to Rolling Stone, The Sun originally reported the British crooner settled a copyright dispute over the weekend with Petty about the similarities between the Grammy-nominated "Stay With Me" and Petty's 1989 "Full Moon Fever" hit, "I Won't Back Down."

Smith's reps confirmed with Rolling Stone that Petty and collaborator Jeff Lynne were added to the song credits because of the songs' similarities.

"Although the likeness was a complete coincidence, all involved came to an immediate and amicable agreement," the rep said.

Petty and Lynne will also receive 12.5 percent of the song's royalties.

"Recently the publishers for the song 'I Won't Back Down,' written by Tom Petty and Jeff Lynne, contacted the publishers for 'Stay With Me,' written by Sam Smith, James Napier and William Phillips, about similarities heard in the melodies of the choruses of the two compositions," Smith's rep said in a statement. "Not previously familiar with the 1989 Petty/Lynne song, the writers of 'Stay With Me' listened to 'I Won't Back Down' and acknowledged the similarity."

Despite Smith's Grammy nomination, Petty and Lynne will not receive a Grammy if the song wins.

"Since Lynne and Petty didn't do any new writing for this work, we are considering their original work to have been interpolated by Napier, Phillips and Smith for 'Stay With Me,'" said Bill Freimuth, the senior vice president of the Recording Academy.

Therefore, Petty and Lynne won't be considered nominees or Grammy recipients. Like other musicians who contributed to a song or had their original work sampled in a Grammy-nominated song, the pair will receive certificates to honor their participation.

"Stay With Me" appears on Smith's debut album, "In the Lonely Hour." Smith is up for best solo performance and record of the year at the 2015 Grammys.