Abba stars Benny Andersson and Bjorn Ulvaeus have criticised the far-right Danish People's Party (DF) for using their hit Mamma Mia at rallies.
The band had threatened to sue the DF, saying the band never allowed their music to be used politically.
But their record company, Universal, later said the DF had agreed to stop using the 1976 hit.
The youth wing of the party had changed the lyrics of the song to Mamma Pia, in honour of their leader Pia Kjaersgaard.
The anti-immigration DF is the third largest party in the Danish parliament.
The DF had played Mamma Mia at rallies and meetings - a version of the song had also been performed for Ms Pia by members of the party' youth wing, say reports.
Mr Andersson said he found out about its use when he was contacted by a left-wing pressure group who asked whether he supported the party's policies.
He said he and Mr Ulvaeus had instructed lawyers to start legal action against the party if they did not stop using the song immediately.
"Firstly, you cannot just rewrite songs as you like and secondly we want them to understand that we have absolutely no interest in supporting their party," he said.
"Abba never allows its music to be used in a political context. This is something that we have pointed out to the Danish People's Party."
Universal Music later said no legal action would be taken as an agreement had been reached.
"The Danish People's Party has agreed to stop using the song and that means the matter is concluded as far as we're concerned," spokesman Olle Ronnback told Danish media.
Abba are not the first musicians to complain about the political use of their songs.
During the 2008 US presidential campaign, several artists, including Heart and the Foo Fighters criticised John McCain and Sarah Palin for using their songs at rallies without permission.
And in 2009, a group of artists in the UK complained that copyright laws meant they had no legal right to prevent the far-right British National Party from selling an album using their songs to raise funds.