Spain will ban ads aimed at children for high-sugar foods and fizzy drinks in a bid to slow a growing obesity epidemic, an official has said.

The ban, which will come into effect in 2022, will target advertisements on television, radio, online outlets and mobile apps peddling content for under-16s, Consumer Affairs Minister Alberto Garzon told reporters.

"Minors are vulnerable consumers and it is our duty to protect them from advertising," he said.

Minister of Consumer Affairs Alberto Garzon spoke during a press conference at Barcelona City Hall

The ban will apply to adverts for chocolate bars, pastries, ice cream, soft drinks and other sugary beverages - products the World Health Organization has said are "harmful" for children.

The minister said Spain would follow in the footsteps of other European nations such as Britain, Norway and Portugal.

Around one in three children in Spain have excess of bodyweight, up from just 3% in 1984, according to Spanish government figures.

"Advertising is one of the causes of this figure," the consumer affairs ministry said in a tweet.

The prevalence of obesity or being overweight among children and adolescents aged five to 19 worldwide has risen dramatically from 4% in 1975 to just over 18%, according to the WHO.