I got a bit lost there. Piggy, as the title of your post says "to UK from Spain", whereas you then go on to refer to a friend who sent a magazine from the UK to Spain. So I'm not too sure which way round you're referring to!
Actual postal charges are at the discretion of the carrier, whether that be Correos, DHL, Fedex or any other provider. However items which are moved across national borders (other than within trading blocs, such as the EU) are also subject to customs examination charges, taxes such as VAT and import duty, as appropriate.
With items arriving into the UK from the EU, routine customs examinations are carried out by Parcelforce Worldwide (on behalf of HMRC), who make a charge of £12 for doing so. (That fee covers items up to the value of £900, with a higher fee being charged thereafter). They then calculate how much VAT and import duty has to be paid by the person receiving the package as well.
In the UK the £12 customs examination fee is waived if it's found that there's no VAT or duty to be paid. That might not be the same in Spain though, which could possibly explain why you had to pay a fee. It might also be because the sender forgot to attach a CN22 form to the package, which is always likely to cause problems anyway.