Upvote:3
Assuming you stay airside you should not need to go through either customs or immigration in London on either your incoming or outgoing flights.
If you do leave the airport you would have to go through immigration and customs but only with your hand baggage.
Upvote:5
In general, the answer is no, you won't go through customs in London.
It depends on a few details like the airlines involved and how you booked your ticket but it should be possible to connect without leaving the sterile transit area of the airport. It means that you won't need to go through customs or immigration in either direction. This does not result from the UK's EU membership but from the way transit is organized in Europe and elsewhere (except North America, obviously). It would also be true if you were connecting to a flight to Asia or Africa instead of Spain.
On the other hand, when flying from Spain to the UK, you are flying within the EU's customs union which mean you have a much larger allowance (you can import just about anything for non-commercial purposes). So if you need to leave the airport and collect your luggage, you could legally go through a special customs lane and import several liters of spirits or thousands of euros/pounds worth of new goods without declaring them, as long as they are for your personal use. This is not allowed when entering the UK from Canada. Maybe that's the source of the confusion?
The UK also maintains its own visa policy, which means that if you would leave the transit lounge of the airport (or enter the country through another port of entry), you would in any case undergo a passport check and get an entry stamp, even if you are coming from another EU country.