Image copyright Reuters Image caption The track Lose Yourself is one of Eminem's biggest hits

A New Zealand political party has been ordered to pay NZ$600,000 ($412,000) in compensation in a breach of copyright suit filed by US rapper Eminem.

The National Party used a track with a similar melody and rhythm to Eminem's Lose Yourself in an election advert.

The song, entitled Eminem-esque, bore only minimal differences to the original, according to a court ruling.

The case, which began in May, is the latest to test the legality of so-called sound-alike music.

Eminem's music publisher, Eight Mile Style, filed proceedings after the National Party used an unlicensed version of the Oscar-winning song in a 2014 campaign advert.

The party's lawyers had argued that the track used was not actually Lose Yourself, but a song called Eminem-esque, which they bought from a stock music library.

However the court ruled on Wednesday that the track was "sufficiently similar" to Eminem's "highly original work", adding that it did indeed infringe copyright laws.

The judgment considered the drum patterns, background chords and violin tones of each version, all of which it said bore "close similarities".

"The nature of the use is not what Eminem or Eight Mile Style would endorse," the judgment added.

Eminem's Lose Yourself, which appeared in the rapper's 2002 film 8 Mile, is one of his biggest hits.

The backing track used in the National Party's advert, which appeared more than 100 times on TV during the 2014 campaign, had been taken from a library made by production music company Beatbox.

Songs which sound similar to famous tracks - but different enough to avoid breaching copyright - routinely feature in free-to-use commercial music libraries.