A Swedish TV network has apologised to Costa Rica for using the Central American country's national anthem to promote a comedy show.

TV4 is using the anthem in a trailer for Parlamentet, a popular gameshow featuring some of Sweden's leading comedians.

After receiving complaints from Costa Ricans living in Sweden, Costa Rica lodged a diplomatic protest, calling the use of its national anthem a "grave disrespect to our national symbol".

A spokesman for TV4, Anders Edholm, told the Associated Press that producers have apologised to Costa Rica's ambassador to Sweden and Norway, and assured him the network would not air the trailer after the first episode of the series was broadcast on Sunday.

Edholm said producers picked the tune from a music library because it was "beautiful and grand" but were unaware it was Costa Rica's national anthem.

"If any Costa Ricans were offended we of course apologise," he said.

The Costa Rican ambassador Manuel Antonio Barrantes Rodríguez said he was pleased by the network's promise not to use the anthem after Sunday.

"At the same time we feel offended," he said. "It's outrageous to use a national anthem as background music."